Type values

From OpenEUO
Revision as of 20:06, 1 November 2010 by Ximan (Talk | contribs) (Created page with "The lua type() function has fixed strings that it returns depending upon the type of value represented by its argument. These fixed strings are 'function', 'nil', 'number', 'str...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The lua type() function has fixed strings that it returns depending upon the type of value represented by its argument. These fixed strings are 'function', 'nil', 'number', 'string', and 'table'.

print(type(print))
print(type('A'))
print(type(1))
print(type({}))
print(type(nil))
local b = 6
print(type(b))
--> 'function'
--> 'string'
--> 'number'
--> 'table'
--> 'nil'
--> 'number'

See Also