There is one very important function built into Lua, type. This function will return the type of a variable as a string. Let's take a look at this function in action:
var1 = true
var2 = 3.145
var3 = nil
var4 = type(var1)
var5 = type(type(var2))
print (type(var1)) -- boolean
print (type(var2)) -- number
print (type(var3)) -- nil
print (var4) -- boolean
print (var5) -- string
Because the type function returns a string, the result can be assigned to a variable, like so:
var4 = type(var1)
Or, the result can be passed directly to a function such as print, like so:
print (type(var1))
The type of the type of something type(type(var2)), as represented by var5, will always be a string. This is because, as stated before, type returns a string.