Difference between revisions of "Type values"
From OpenEUO
m (→See Also) |
m |
||
Line 1: | Line 1: | ||
− | The lua type() function has fixed strings that it returns depending upon the type of value represented by its argument. These fixed strings are 'boolean', 'function', 'nil', 'number', 'string', | + | The lua type() function has fixed strings that it returns depending upon the type of value represented by its argument. These fixed strings are 'boolean', 'function', 'nil', 'number', 'string', 'table' (and uncommonly in openeuo 'userdata' and 'thread'). |
print(type(print)) | print(type(print)) |
Revision as of 23:37, 1 November 2010
The lua type() function has fixed strings that it returns depending upon the type of value represented by its argument. These fixed strings are 'boolean', 'function', 'nil', 'number', 'string', 'table' (and uncommonly in openeuo 'userdata' and 'thread').
print(type(print)) print(type('A')) print(type(1)) print(type({})) print(type(nil)) local b = 6 print(type(b)) print(type(false))
--> 'function' --> 'string' --> 'number' --> 'table' --> 'nil' --> 'number' --> 'boolean'