LuaScript Xojo and Real Studio Plugin |
|
LuaScript.LoadFunction Method (console safe)
Loads a function from Lua script by name to prepare to execute it.
LoadFunction(
name as String) as Boolean
Parameters
- name
- The name of the function to load.
Returns
- Boolean
- True if loading the function was successful, else false.
Remarks
The normal flow would be:
1. Load the function.
2. Add parameters to it.
3. Call the function.
4. Get back return parameters.
if lua.LoadFunction("test") then
lua.Push(5) // We want to send 5 down as parameter to the function so we push it to the stack.
// Then we just call the function and we specify that we have one parameter and one return value.
if lua.CallFunction(1,1) then
MsgBox "The result is: " + Str(lua.GetInteger(-1,true))
else
MsgBox lua.GetLastErrorMessage()
end if
else
MsgBox "Could not load function called test"
end if
See Also
LuaScript Class