string.lower

From Garry's Mod
Revision as of 03:13, 21 November 2016 by MafiaMafiaMafia (Talk | contribs)
Jump to: navigation, search
 string.lower( )

Contents

Description

Changes any upper-case letters in a string to lower-case letters.

Arguments

string str

The string to convert.

Returns

string

A string representing the value of a string converted to lower-case.

Examples

Example

Demonstrates the use of this function.

print( string.lower( "ABCDEFG" ) )
print( string.lower( "AbCdefG" ) )
print( string.lower( "abcdefg" ) )
print( string.lower( "1234567890" ) )

Output:


abcdefg
abcdefg
abcdefg
1234567890

Examples

Example

Demonstrates opening a menu when !openmenu is typed in chat.

local function myMenu()
    local frame = vgui.Create( "DFrame" )
	frame:SetSize( 400, 400 )
	frame:Center()
	frame:MakePopup()
end

hook.Add( "OnPlayerChat" , "AnyName" , function( ply, text )
    if ply == LocalPlayer() then -- Makes sure its the local player
        if string.lower( text ) == "!openmenu" then -- Checks if the player had wrote a chat message saying !openmenu
            myMenu() -- Calling the local function to start
        end
    end
end )

Output:

When you type !openmenu in chat, the DFrame pops up.
Personal tools
Navigation