galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::lua::Script Class Referencefinal

A basic script is usually only run once or run when something specific happens. More...

#include <Script.hpp>

+ Collaboration diagram for galaxy::lua::Script:

Public Member Functions

 Script ()
 Constructor.
 
 Script (const std::string &file)
 Argument Constructor.
 
 ~Script ()
 Destructor.
 
bool load (const std::string &file)
 Load a script.
 
bool run ()
 Run a lua script.
 
sol::protected_function_result run_and_return ()
 Run a lua script and get a return value.
 

Private Attributes

sol::load_result m_script
 Script loaded into sol3 memory.
 
bool m_loaded
 Flag to make sure script is loaded.
 

Detailed Description

A basic script is usually only run once or run when something specific happens.

Definition at line 20 of file Script.hpp.

Constructor & Destructor Documentation

◆ Script() [1/2]

galaxy::lua::Script::Script ( )

Constructor.

Definition at line 18 of file Script.cpp.

◆ Script() [2/2]

galaxy::lua::Script::Script ( const std::string & file)

Argument Constructor.

Parameters
fileFile in VFS to load as a script.

Definition at line 23 of file Script.cpp.

+ Here is the call graph for this function:

◆ ~Script()

galaxy::lua::Script::~Script ( )

Destructor.

Definition at line 29 of file Script.cpp.

Member Function Documentation

◆ load()

bool galaxy::lua::Script::load ( const std::string & file)
nodiscard

Load a script.

Parameters
fileFile in VFS to load as a script.

Definition at line 33 of file Script.cpp.

+ Here is the caller graph for this function:

◆ run()

bool galaxy::lua::Script::run ( )

Run a lua script.

Returns
True if script executed successfully.

Definition at line 59 of file Script.cpp.

◆ run_and_return()

sol::protected_function_result galaxy::lua::Script::run_and_return ( )
nodiscard

Run a lua script and get a return value.

Returns
Value returned from script execution. You will need to extract from function result and check validity.

Definition at line 70 of file Script.cpp.

Member Data Documentation

◆ m_script

sol::load_result galaxy::lua::Script::m_script
private

Script loaded into sol3 memory.

Definition at line 68 of file Script.hpp.

◆ m_loaded

bool galaxy::lua::Script::m_loaded
private

Flag to make sure script is loaded.

Definition at line 73 of file Script.hpp.


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