Value:tonumber()method

Converts the C Value to a Lua number or to a Lua integer if the value fits in it.

Return value

Returns a number representation of the C Value.

Example

--! luart-extensions import c -- Create a Value that contains a C integer value initialized to 125 local c_int = c.int(125) -- Converts the C integer Value to a Lua number, and prints it print(c_int:tonumber())