string.byte

From GMod Wiki

Jump to: navigation, search
Function
Syntax string.byte( String str [, Integer start [, Integer end ]] )
Where is this used?
Description:
Return the numeric value(s) of a portion of str, from start to end. If start or end are not specified, they are assumed to be 1 and start + 1, respectively.
Returns: Number number or Number number1, Number number2, ...
Part of Library: String
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=String.byte]String.byte [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionDemonstrates the string.byte function by outputting the ASCII value(s) of character(s) in a string
Used onNewerShared.png
Code
s = "ABCDEF"
print(string.byte(s))
print(string.byte(s, 2))
print(string.byte(s, 3, 5))
 
Output65

66

67       68       69


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox