fn: lua_tostring
[contents]

Contents

Syntax

The syntax for lua_tostring calls is:

f++:  
lua_tostring(int)

n++:  
@lua_tostring(int)

Description

The lua_tostring function returns the string value on the Lua stack at the given acceptable index, it is a binding for this function (which is equivalent to this function).

Note: The value on the Lua stack at the specified index must be a string or a number; otherwise, the function returns NULL. If the value is a number, then lua_tostring also changes the actual value in the stack to a string. (This change confuses lua_next when lua_tostring is applied to keys during a table traversal.)

f++ example

Example of lua_tostring being used with f++:

lua
{
	str = "hello, world!"
}
lua_getglobal("str")
console("lua_tostring(1)")

n++ example

Example of lua_tostring being used with n++:

@lua
{
	str = "hello, world!"
}
@lua_getglobal("str")
@console("@lua_tostring(1)")