LuaScript Xojo Plugin |

# LuaScript Class (console safe)

This class is used to implement a Lua script interpreter in Xojo or Real Studio.
Note:
Not all that Lua can do is implemented in this first version. Some features in the Bridge from Lua to the host application will be added in upcoming versions of this plugin such as hooks for example. The io class in Lua is not supported at this time except for io.write.

LuaScriptContext
LuaScript

class LuaScript

#### Constructors

LuaScript | A default constructor to be used when the LuaScript class does not live on a window.

#### Properties

ParameterCount (Inherited) | Returns the number of parameters.

#### Methods

CallFunction | Calls a function that has been previously loaded by the LoadFunction method.
FunctionExists | Checks if a function with a given name exists.
GetBoolean (Inherited) | Fetches a boolean value from the stack
GetCurrentLine (Inherited) | Returns the current line that is executing in the Lua script.
GetDouble (Inherited) | Fetches a double value from the stack
GetGlobalBoolean (Inherited) | Gets a global boolean variable by name.
GetGlobalDouble (Inherited) | Gets a global Double variable by name.
GetGlobalInteger (Inherited) | Gets a global integer variable by name.
GetGlobalObject (Inherited) | Gets a global Xojo or Real Studio object variable by name.
GetGlobalString (Inherited) | Gets a global string variable by name.
GetGlobalTable (Inherited) | Gets a global table variable by name and puts it at top of the stack.
GetInteger (Inherited) | Fetches a integer value from the stack
GetLastErrorMessage | Fetches the last error that happened if a error was raised in the script.
GetLength (Inherited) | 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 (Inherited) | Used to traverse tables. Returns zero if no next element was found else non zero value
GetObject (Inherited) | Fetches a Xojo or Real Studio object value from the stack
GetStackTrace (Inherited) | Gets stack trace of the current code execution.
GetString (Inherited) | Fetches a string value from the stack
GetTableValue (Inherited) | Pushes a table value to the top of the stack
IsBoolean (Inherited) | Checks if a item on the stack is a boolean variable.
IsNil (Inherited) | Checks if a item on the stack is a nil.
IsNone (Inherited) | Checks if a item on the stack is none.
IsNoneOrNil (Inherited) | Checks if a item on the stack is a nil or none.
IsNumber (Inherited) | Checks if a item on the stack is a double variable.
IsObject (Inherited) | Checks if a item on the stack is a REALbasic object variable.
IsString (Inherited) | Checks if a item on the stack is a string variable.
IsTable (Inherited) | Checks if a item on the stack is a table.
LoadFunction | Loads a function from Lua script by name to prepare to execute it.
LoadScript | Loads a Lua script from a string. Any global code gets executed when loading the script if any such exists in the script. Functions and classes do not get executed until their called.
NewTable (Inherited) | Creates a new empty table structure.
Pop (Inherited) | Pops one item from the stack.
Push (Inherited) | Pushes a Boolean value to the stack. This is often used to return values from a function.
Push (Inherited) | Pushes a Double value to the stack. This is often used to return values from a function.
Push (Inherited) | Pushes a Integer value to the stack. This is often used to return values from a function.
Push (Inherited) | Pushes a Xojo or Real Studio object to the stack. This is often used to return values from a function.
Push (Inherited) | Pushes a String value to the stack. This is often used to return values from a function.
PushFunction (Inherited) | 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 (Inherited) | Pushes a Lua nil onto the stack. This is sometimes used when traversing table content.
RegisterFunction | Registers a Xojo or Real Studio function that can be called from within Lua.
SetError (Inherited) | Raises a error. Use this function from within a Xojo or Real Studio function that is registered to be exposed to Lua.
SetGlobal (Inherited) | Sets the top most element of the stack as global. (This is often used for tables)
SetGlobal (Inherited) | Sets a global Boolean variable.
SetGlobal (Inherited) | Sets a global double variable.
SetGlobal (Inherited) | Sets a global integer variable.
SetGlobal (Inherited) | Sets a global Xojo or Real Studio object variable.
SetGlobal (Inherited) | Sets a global string variable.
SetTableValue (Inherited) | Takes two top most elements on the stacks and sets them as table element pair. (Key and Value)
WireInstanceToClass (Inherited) | Wires a table instance that represents the data of a class to a Lua class declaration.

#### Events

ConsoleOutput | This event is called when the Lua script wants to output something with its print function, then the print function will send its data to this event.

#### Constants

LUA_MULTRET = -1 |
DEBUG_HOOK_MASKCALL = 1 (Inherited) |
DEBUG_HOOK_MASKRET = 2 (Inherited) |
DEBUG_HOOK_MASKLINE = 4 (Inherited) |
DEBUG_HOOK_MASKCOUNT = 8 (Inherited) |

#### 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