fn: lua_tonumber
[contents]

Contents

Syntax

The syntax for lua_tonumber calls is:

f++:  
lua_tonumber(int)

n++:  
@lua_tonumber(int)

Description

The lua_tonumber function returns the number value on the Lua stack at the given acceptable index, it is a binding for this function. The value on the Lua stack at the specified index must be a number or a string convertible to a number (see ยง2.2.1), otherwise lua_tonumber returns 0.

f++ example

Example of lua_tonumber being used with f++:

lua
{
	x = 10
}
lua_getglobal("x")
console(lua_tonumber(1))

n++ example

Example of lua_tonumber being used with n++:

@lua
{
	x = 10
}
@lua_getglobal("x")
@console(@lua_tonumber(1))