LuaSTG-x Core API
|
The following standard library functions have been extended to work with cdata objects:
local n = tonumber(cdata)
Converts a number cdata object to a double and returns it as a Lua number. This is particularly useful for boxed 64 bit integer values. Caveat: this conversion may incur a precision loss.
local s = tostring(cdata)
Returns a string representation of the value of 64 bit integers ("nnnLL" or "nnnULL") or complex numbers ("re±imi"). Otherwise returns a string representation of the C type of a ctype object ("ctype<type>") or a cdata object ("cdata<type>: address"), unless you override it with a __tostring metamethod (see ffi.metatype()).
local iter, obj, start = pairs(cdata)
iter, obj, start = ipairs(cdata)
Calls the __pairs or __ipairs metamethod of the corresponding ctype.