lua_tonumberx

Function lua_tonumberx 

Source
pub unsafe extern "C-unwind" fn lua_tonumberx(
    L: *mut lua_State,
    idx: c_int,
    isnum: *mut c_int,
) -> lua_Number
Expand description

Attempts to convert the value at the given index to a number.

This function attempts to convert the value at the given index to a number, returning the value if successful, or 0.0 if the conversion failed.

As 0.0 is a valid Luau number and cannot be used to indicate failure, the function also allows for an optional pointer which it will set to 0 if the conversion failed, or 1 if it succeeded.

This function will leave numbers as is, and will transform strings which can be parsed as numbers into numbers. This will modify the stack.