These functions can be called with any acceptable index.
The lua_is*
functions return 1 if the object is compatible with the given type, and 0 otherwise. lua_isboolean
is an exception to this rule: It succeeds only for boolean values (otherwise it would be useless, as any value has a boolean value). They always return 0 for a non-valid index. lua_isnumber
accepts numbers and numerical strings; accepts strings and numbers (see ); lua_isfunction
accepts both Lua functions and C functions; and lua_isuserdata
accepts both full and light userdata. To distinguish between Lua functions and C functions, you can use lua_iscfunction
. To distinguish between full and light userdata, you can use lua_islightuserdata
. To distinguish between numbers and numerical strings, you can use lua_type
.
lua_equal
and lua_lessthan
are equivalent to their counterparts in Lua (see 2.5.2). compares the values for primitive equality, without metamethods. These functions return 0 (false) if any of the indices are non-valid.