Struct Engine::ScriptComponent¶
ClassList > Engine > ScriptComponent
Component that attaches a Lua script to an entity. More...
#include <ScriptComponent.hpp>
Public Attributes¶
| Type | Name |
|---|---|
| bool | autoReload = trueIf true, the script will be reloaded automatically when the file changes. |
| bool | loaded = falseInternal: whether the script has been loaded successfully. |
| std::string | scriptPath Path to the Lua script file, relative to the project folder. |
| sol::table | scriptTable = sol::lua\_nilInternal: sol2 table handle returned by the script. |
Public Functions¶
| Type | Name |
|---|---|
| ScriptComponent () = default |
|
| ScriptComponent (const std::string & path, bool autoReload_=true) |
Detailed Description¶
The script should return a table with optional lifecycle functions: * onCreate(entity) * onUpdate(entity, dt) * onDestroy(entity)
Public Attributes Documentation¶
variable autoReload¶
If true, the script will be reloaded automatically when the file changes.
variable loaded¶
Internal: whether the script has been loaded successfully.
variable scriptPath¶
Path to the Lua script file, relative to the project folder.
variable scriptTable¶
Internal: sol2 table handle returned by the script.
Public Functions Documentation¶
function ScriptComponent [½]¶
function ScriptComponent [2/2]¶
inline explicit Engine::ScriptComponent::ScriptComponent (
const std::string & path,
bool autoReload_=true
)
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Scripting/ScriptComponent.hpp