Home | Features | Roadmap | Learn | Documentation | ||
Latest version: Tramway SDK 0.0.9 Github Quick links Home Get Started |
ScriptingThe script system implements the scripting API. It allows you to call scripts from C++ without being concerned with which scripting language the script is actually implemented in. Currently the only scripting language bindings that have been implemented are for the Lua language.
All scripts are located in the Programming in C++
First a script needs to be loaded. When a script is loaded from disk, it will be automatically executed.
Script::LoadScript("frog");
You can set global variables in the scripting context and retrieve global variables from it.
Script::SetGlobal("frog_status", 420);
You can also register in C++ function which can be called from the scripting
language. For example, this function, named
Script::SetFunction("frog", {TYPE_INT},
You can also call script functions from C++.
bool result = Script::CallFunction("frog", {420});
|
|
|