G.tonumber

From GMod Wiki

Jump to: navigation, search
Function
Syntax tonumber( Var var,Integer Base )
Where is this used?
Description:
Attempts to cast the argument to a number. Returns nil if it is not a number.
Returns: Integer
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.tonumber]G.tonumber [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionConvert to a number
Used onNewerShared.png
Code
print( type( tonumber( "5" ) )
OutputNumber


DescriptionConvert to a number
Used onNewerShared.png
Code
print( type( tonumber( "e5" ) )
Output[[]]


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox