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
Script.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_SCRIPTING_SCRIPT_HPP_
9#define GALAXY_SCRIPTING_SCRIPT_HPP_
10
11#include <sol/sol.hpp>
12
13namespace galaxy
14{
15 namespace lua
16 {
20 class Script final
21 {
22 public:
26 Script();
27
33 Script(const std::string& file);
34
38 ~Script();
39
45 [[nodiscard]]
46 bool load(const std::string& file);
47
53 [[maybe_unused]]
54 bool run();
55
61 [[nodiscard]]
62 sol::protected_function_result run_and_return();
63
64 private:
68 sol::load_result m_script;
69
74 };
75 } // namespace lua
76} // namespace galaxy
77
78#endif
A basic script is usually only run once or run when something specific happens.
Definition Script.hpp:21
bool load(const std::string &file)
Load a script.
Definition Script.cpp:33
sol::protected_function_result run_and_return()
Run a lua script and get a return value.
Definition Script.cpp:70
Script()
Constructor.
Definition Script.cpp:18
sol::load_result m_script
Script loaded into sol3 memory.
Definition Script.hpp:68
bool m_loaded
Flag to make sure script is loaded.
Definition Script.hpp:73
bool run()
Run a lua script.
Definition Script.cpp:59
~Script()
Destructor.
Definition Script.cpp:29
Timer.hpp galaxy.
Definition Async.hpp:17