LuaScript Xojo and Real Studio Plugin

LuaScriptContext.SetGlobal Method (console safe)

Sets the top most element of the stack as global. (This is often used for tables)

SetGlobal(
   name as String)

Parameters

name
Name of the variable to be set

Remarks

Value is popped off the stack as its set to global.

Dim i as Integer

lua.NewTable()

for i = 1 to 5
    lua.Push(i) // Push the table index
    lua.Push("Some cell text: " + Str(i * i)) // Push the cell value
    lua.SetTableValue() // Store the pair in the table
next

lua.SetGlobal("foo") // Expose the table to Lua as "foo"

See Also

LuaScriptContext Class