LuaScript Xojo and Real Studio Plugin |
|
LuaScriptContext.PushFunction Method (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)
PushFunction(
function as Ptr)
Parameters
- function
- The address of the REALbasic function.
Remarks
Note that the signature of the function always has to be:
Function [FunctionName](lua as Ptr) As Integer
Dim i as Integer
lua.NewTable()
lua.Push("New")
lua.PushFunction(AddressOf LuaVectorClass.NewVector)
lua.SetTableValue() // Store the pair in the table
lua.Push("Magnitude")
lua.PushFunction(AddressOf LuaVectorClass.Magnitude)
lua.SetTableValue() // Store the pair in the table
lua.SetGlobal("CustomVector") // Expose the table to Lua as "CustomVector"
See Also
LuaScriptContext Class