Type Function Library (globals) Return value String Revision 2017.3060 Keywords type, datatype
Returns the type of its argument. Possible results are:
"nil" (a string, not a nil value)"number""string""boolean""table""function""thread""userdata"type( v )
The item whose type is to be determined.
local t = {}
local n = 123
local s = "Hello world!"
local b = true
local function f() return "this is a string"; end
local type_t = type( t ) -- "table"
lcoal type_n = type( n ) -- "number"
local type_s = type( s ) -- "string"
local type_b = type( b ) -- "boolean"
local type_f1 = type( f ) -- "function"
local type_f2 = type( f() ) -- "string"