Loads and runs Lua scripts.
More...
#include <kanzi/lua/lua_instance.hpp>
Loads and runs Lua scripts.
Use the LuaModule to initialize, retrieve, and free the LuaInstance.
- See also
- LuaModule
- Since
- Kanzi 3.9.9
kanzi::LuaInstance::~LuaInstance |
( |
| ) |
|
void kanzi::LuaInstance::run |
( |
string_view |
scriptName | ) |
|
Runs a previously loaded Lua script with a matching name.
- Parameters
-
scriptName | Name of the script to be run. If nullopt, runs the latest loaded Lua script. |
void kanzi::LuaInstance::run |
( |
string_view |
scriptName, |
|
|
NodeSharedPtr |
contextNode |
|
) |
| |
Runs a previously loaded Lua script with a matching name.
- Parameters
-
scriptName | Name of the script to be run. |
contextNode | The context node attached to the script. |
Runs a previously loaded resource loaded as a Lua script.
- Parameters
-
resource | The binary resource that contains the Lua script to run. |
Runs a previously loaded resource loaded as a Lua script.
- Parameters
-
resource | The binary resource that contains the Lua script to run. |
contextNode | The context node attached to the script. |
bool kanzi::LuaInstance::loadScript |
( |
string_view |
scriptName, |
|
|
string_view |
code |
|
) |
| |
Loads a Lua script and assigns a name to the script.
When you assign a name that is already in use by another script, the script replaces the previously loaded script.
- Parameters
-
code | Lua script to load. |
scriptName | Name of the script. |
- Returns
- True if the script is loaded.
Loads a binary resource as a Lua script.
The script does not load the script if is already loaded. The name of the script is the resource URL.
- Parameters
-
resource | The binary resource that contains the Lua script. |
- Returns
- True if the binary resource is loaded as a Lua script.
Set to binary resources of scripts that are loaded into the Lua instance.
The documentation for this class was generated from the following file: