Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::ScriptComponent Class Reference

Component that handles Lua scripting. More...

#include <components.hpp>

Public Member Functions

 ScriptComponent (const std::string &script)
 Constructs a script component with the given script code.
 
 ~ScriptComponent ()
 Destructor that cleans up the Lua state.
 
void ExecuteFunction (const std::string &functionName)
 Executes a Lua function within the script.
 

Public Attributes

lua_State * luaState
 
std::string scriptCode
 
bool enabled = true
 
bool pause = true
 

Detailed Description

Component that handles Lua scripting.

Definition at line 113 of file components.hpp.

Constructor & Destructor Documentation

◆ ScriptComponent()

Raftel::ScriptComponent::ScriptComponent ( const std::string & script)

Constructs a script component with the given script code.

Parameters
scriptThe Lua script code.

Member Function Documentation

◆ ExecuteFunction()

void Raftel::ScriptComponent::ExecuteFunction ( const std::string & functionName)

Executes a Lua function within the script.

Parameters
functionNameThe name of the function to execute.

Member Data Documentation

◆ enabled

bool Raftel::ScriptComponent::enabled = true

Whether the script is enabled.

Definition at line 134 of file components.hpp.

◆ luaState

lua_State* Raftel::ScriptComponent::luaState

Lua state for script execution.

Definition at line 132 of file components.hpp.

◆ pause

bool Raftel::ScriptComponent::pause = true

Whether the script execution is paused.

Definition at line 135 of file components.hpp.

◆ scriptCode

std::string Raftel::ScriptComponent::scriptCode

Script source code.

Definition at line 133 of file components.hpp.


The documentation for this class was generated from the following file: