LuaScript Xojo and Real Studio 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

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

Properties

ParameterCount (Inherited) (console safe) Returns the number of parameters.

Methods

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

Events

ConsoleOutputThis 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 = -1Specifies that all should be pushed onto the stack in the CallFunction function.

Supported Platforms:

  • MacOS X Carbon
  • MacOS X Cocoa
  • Win32 - Windows
  • Linux x86

    Unsupported Platforms: