Garry's Mod Wiki

string.GetChar

  string string.GetChar( string str, number index )

Description

We advise against using this. It may be changed or removed in a future update. Use either string.sub(str, index, index) or str[index].

Returns char value from the specified index in the supplied string.

Arguments

1 string str
The string that you will be searching with the supplied index.
2 number index
The index's value of the string to be returned.

Returns

1 string
str

Example

Looks index in the supplied string and returns value of that index.

local char = "ABC" print(string.GetChar(char, 2))
Output: B