ST_engine
0.3-ALPHA
|
This class handles all interaction with lua. More...
#include <lua_backend.hpp>
Public Member Functions | |
int | initialize (message_bus *msg_bus, game_manager *game_mngr) |
void | set_global (const std::string &arg) |
void | run_global (const std::string &arg) |
int8_t | run_file (const std::string &file) |
int8_t | load_file (const std::string &) |
int8_t | run_script (const std::string &script) |
void | close () |
Friends | |
class | lua_backend_test |
This class handles all interaction with lua.
It loads lua scripts and runs them. Also provides Lua with the API to the internal engine code. This is the bridge between gameplay and engine code.
Definition at line 31 of file lua_backend.hpp.
void lua_backend::close | ( | ) |
Close the Lua State.
Definition at line 295 of file lua_backend.cpp.
int lua_backend::initialize | ( | message_bus * | msg_bus, |
game_manager * | game_mngr | ||
) |
Initializes the Lua subsystem.
msg_bus | A pointer to the global msg_bus. |
game_mngr | A pointer to the game_manager object. |
Definition at line 41 of file lua_backend.cpp.
int8_t lua_backend::load_file | ( | const std::string & | file | ) |
Loads a file into the global Lua State, but does not run it.
file | The path to the file. |
Definition at line 248 of file lua_backend.cpp.
int8_t lua_backend::run_file | ( | const std::string & | file | ) |
Run a lua script inside the global Lua state.
file | The path to the file. |
Definition at line 231 of file lua_backend.cpp.
void lua_backend::run_global | ( | const std::string & | arg | ) |
Run a already set global.
arg | The name of the global. |
Definition at line 287 of file lua_backend.cpp.
int8_t lua_backend::run_script | ( | const std::string & | script | ) |
Run a lua script contained in a string.
script | The Lua Script to run. |
Definition at line 265 of file lua_backend.cpp.
void lua_backend::set_global | ( | const std::string & | arg | ) |
Set a loaded script as a global.
arg | The name of the script to set as global. |
Definition at line 279 of file lua_backend.cpp.