LuaScript Xojo and Real Studio Plugin

LuaScriptContext.GetTableValue Method (console safe)

Pushes a table value to the top of the stack

GetTableValue(
   name as String,
   relativeIndex as Integer)

Parameters

name
Name of the table value to get
relativeIndex
Index relative to top most position in the stack, 0 = current top.

Remarks

if ls.GetGlobalTable("background") then
    ls.GetTableValue("red",0) // 0 because table is at top of the stack
    red = ls.GetInteger(-1,true)
   
    ls.GetTableValue("green",0) // 0 because table is at top of the stack
    red = ls.GetInteger(-1,true)
   
    ls.GetTableValue("blue",0) // 0 because table is at top of the stack
    blue = ls.GetInteger(-1,true)
   
    ls.Pop() // We pop the table off the stack once we are done with it
   
    MsgBox "Red: " + Str(red) + ", Green: " + Str(green) + ", Blue: " + Str(blue)
end if

See Also

LuaScriptContext Class