fn: lua_pushlightuserdata

[contents]

Contents

Syntax

The syntax for lua_pushlightuserdata calls is:

f++:  
lua_pushlightuserdata(var)

n++:  
@lua_pushlightuserdata(var)

Description

The lua_pushlightuserdata function takes a single variable parameter and pushes a pointer to the variable on to the Lua stack as a lightuserdata, it is a binding for this function.

f++ example

Example of lua_pushlightuserdata being used with f++:

:=(string, str)
lua_pushlightuserdata(str)
lua_setglobal("s")
lua_addnsmfns
lua
{
	nsm_setstring(s, "hello, world!")
}
console(str)

Note: You can achieve essentially the same as above as follows:

:=(string, str)
lua_addnsmfns
lua
{
	s = nsm_tolightuserdata("str")
	nsm_setstring(s, "hello, world!")
}
console(str)

n++ example

Example of lua_pushlightuserdata being used with n++:

@:=(string, str)
@lua_pushlightuserdata(str)
@lua_setglobal("s")
@lua_addnsmfns
@lua
{
	nsm_setstring(s, "hello, world!")
}
@console(str)