Tao.Lua SDK Documentation

Lua.luaL_ref Method 

Creates and returns a reference, in the table at index t, for the object at the top of the stack (and pops the object).

[Visual Basic]
Public Shared Function luaL_ref( _
   ByVal L As IntPtr, _
   ByVal t As Integer _
) As Integer
[C#]
public static int luaL_ref(
   IntPtr L,
   int t
);

Parameters

L
t

Return Value

Remarks

A reference is a unique integer key. As long as you do not manually add integer keys into table t, luaL_ref ensures the uniqueness of the key it returns. You can retrieve an object referred by reference r by calling lua_rawgeti(L, t, r). Function luaL_unref frees a reference and its associated object. If the object at the top of the stack is nil, luaL_ref returns the constant LUA_REFNIL. The constant LUA_NOREF is guaranteed to be different from any reference returned by luaL_ref.

See Also

Lua Class | Tao.Lua Namespace