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

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

Properties

ParameterCountReturns the number of parameters.

Methods

GetBooleanFetches a boolean value from the stack
GetCurrentLineReturns the current line that is executing in the Lua script.
GetDoubleFetches a double value from the stack
GetGlobalBooleanGets a global boolean variable by name.
GetGlobalDoubleGets a global Double variable by name.
GetGlobalIntegerGets a global integer variable by name.
GetGlobalObjectGets a global Xojo or Real Studio object variable by name.
GetGlobalStringGets a global string variable by name.
GetGlobalTableGets a global table variable by name and puts it at top of the stack.
GetIntegerFetches a integer value from the stack
GetLengthIf 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.
GetNextUsed to traverse tables. Returns zero if no next element was found else non zero value
GetObjectFetches a Xojo or Real Studio object value from the stack
GetStackTraceGets stack trace of the current code execution.
GetStringFetches a string value from the stack
GetTableValuePushes a table value to the top of the stack
IsBooleanChecks if a item on the stack is a boolean variable.
IsNilChecks if a item on the stack is a nil.
IsNoneChecks if a item on the stack is none.
IsNoneOrNilChecks if a item on the stack is a nil or none.
IsNumberChecks if a item on the stack is a double variable.
IsObjectChecks if a item on the stack is a REALbasic object variable.
IsStringChecks if a item on the stack is a string variable.
IsTableChecks if a item on the stack is a table.
NewTableCreates a new empty table structure.
PopPops one item from the stack.
PushPushes a Boolean value to the stack. This is often used to return values from a function.
PushPushes a Double value to the stack. This is often used to return values from a function.
PushPushes a Integer value to the stack. This is often used to return values from a function.
PushPushes a Xojo or Real Studio object to the stack. This is often used to return values from a function.
PushPushes a String value to the stack. This is often used to return values from a function.
PushFunctionPushes a function to the stack. (This is often used to define classes from within Xojo or Real Studio that are exposed to Lua)
PushNilPushes a Lua nil onto the stack. This is sometimes used when traversing table content.
SetErrorRaises a error. Use this function from within a Xojo or Real Studio function that is registered to be exposed to Lua.
SetGlobalSets the top most element of the stack as global. (This is often used for tables)
SetGlobalSets a global Boolean variable.
SetGlobalSets a global double variable.
SetGlobalSets a global integer variable.
SetGlobalSets a global Xojo or Real Studio object variable.
SetGlobalSets a global string variable.
SetTableValueTakes two top most elements on the stacks and sets them as table element pair. (Key and Value)
WireInstanceToClassWires 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