LuaScript Xojo Plugin |

# LuaScriptContext Class (console safe)

This class is used in Xojo or Real Studio functions that you expose to Lua. The purpose of this class is to get parameters from Lua and to send return values to Lua. This class is also the base class of the LuaScript class.

Object
LuaScriptContext

class LuaScriptContext

#### Constructors

LuaScriptContext | Constructor that constructs the LuaScriptContext from a Ptr in a REALbasic function that Lua is calling.

#### Properties

ParameterCount | Returns the number of parameters.

#### Methods

GetBoolean | Fetches a boolean value from the stack
GetCurrentLine | Returns the current line that is executing in the Lua script.
GetDouble | Fetches a double value from the stack
GetGlobalBoolean | Gets a global boolean variable by name.
GetGlobalDouble | Gets a global Double variable by name.
GetGlobalInteger | Gets a global integer variable by name.
GetGlobalObject | Gets a global Xojo or Real Studio object variable by name.
GetGlobalString | Gets a global string variable by name.
GetGlobalTable | Gets a global table variable by name and puts it at top of the stack.
GetInteger | Fetches a integer value from the stack
GetLength | If checking length of a string element then this returns the string length, if checking the length of a Lua table then this returns the same as the Lua # operator returns.
GetNext | Used to traverse tables. Returns zero if no next element was found else non zero value
GetObject | Fetches a Xojo or Real Studio object value from the stack
GetStackTrace | Gets stack trace of the current code execution.
GetString | Fetches a string value from the stack
GetTableValue | Pushes a table value to the top of the stack
IsBoolean | Checks if a item on the stack is a boolean variable.
IsNil | Checks if a item on the stack is a nil.
IsNone | Checks if a item on the stack is none.
IsNoneOrNil | Checks if a item on the stack is a nil or none.
IsNumber | Checks if a item on the stack is a double variable.
IsObject | Checks if a item on the stack is a REALbasic object variable.
IsString | Checks if a item on the stack is a string variable.
IsTable | Checks if a item on the stack is a table.
NewTable | Creates a new empty table structure.
Pop | Pops one item from the stack.
Push | Pushes a Boolean value to the stack. This is often used to return values from a function.
Push | Pushes a Double value to the stack. This is often used to return values from a function.
Push | Pushes a Integer value to the stack. This is often used to return values from a function.
Push | Pushes a Xojo or Real Studio object to the stack. This is often used to return values from a function.
Push | Pushes a String value to the stack. This is often used to return values from a function.
PushFunction | Pushes a function to the stack. (This is often used to define classes from within Xojo or Real Studio that are exposed to Lua)
PushNil | Pushes a Lua nil onto the stack. This is sometimes used when traversing table content.
SetError | Raises a error. Use this function from within a Xojo or Real Studio function that is registered to be exposed to Lua.
SetGlobal | Sets the top most element of the stack as global. (This is often used for tables)
SetGlobal | Sets a global Boolean variable.
SetGlobal | Sets a global double variable.
SetGlobal | Sets a global integer variable.
SetGlobal | Sets a global Xojo or Real Studio object variable.
SetGlobal | Sets a global string variable.
SetTableValue | Takes two top most elements on the stacks and sets them as table element pair. (Key and Value)
WireInstanceToClass | Wires a table instance that represents the data of a class to a Lua class declaration.

#### Constants

DEBUG_HOOK_MASKCALL = 1 |
DEBUG_HOOK_MASKRET = 2 |
DEBUG_HOOK_MASKLINE = 4 |
DEBUG_HOOK_MASKCOUNT = 8 |

#### Supported Platforms:

- macOS Intel 32 bit
- macOS Intel 64 bit
- macOS Apple Silicon
- Windows 32 bit
- Windows 64 bit
- Windows ARM 64 bit
- Linux 32 bit
- Linux 64 bit
- Linux ARM 32 bit
- Linux ARM 64 bit
- iOS