fn: lua_setglobal
[contents]

Contents

Syntax

The syntax for lua_setglobal calls is:

f++:  
lua_setglobal(string)

n++:  
@lua_setglobal(string)

Description

The lua_setglobal function takes a single string parameter, pops a value from the Lua stack and sets it as the value for a Lua global variable given the name of the input parameter, it is a binding for this function.

f++ example

Example of lua_setglobal being used with f++:

lua_pushstring("hello, world!")
lua_setglobal("str")
lua
{
	print(str)
}

n++ example

Example of lua_setglobal being used with n++:

@lua_pushstring("hello, world!")
@lua_setglobal("str")
@lua
{
	print(str)
}