Parses lua scripts into C++.
More...
#include <LuaScript.h>
Parses lua scripts into C++.
| LuaScript::LuaScript |
( |
const std::string & |
filename_) | |
|
The constructor.
Initializes a new lua state, and loads the desired script.
- Parameters
-
| filename_ | : Path to the desired script, i.e. "lua/level1/Player.lua". |
- Todo:
- Log an error message for different lua error codes.
| LuaScript::~LuaScript |
( |
) | |
|
|
virtual |
The destructor.
Closes the lua state, if open.
template<typename T >
| T LuaScript::unlua_get |
( |
const std::string & |
variableName_) | |
|
Gets value of desired variable.
Template for the different get methods, which recieve a different type of value.
- Parameters
-
| variableName_ | : The varaible you want to get a value from. |
- Returns
- The T value stored in 'variableName_' inside the lua script.
template<typename T >
| T LuaScript::unlua_getDefault |
( |
) | |
|
|
private |
Gets a default value.
- Returns
- Value 0 or a string "null", depending on how it is called.
| std::vector< int > LuaScript::unlua_getIntVector |
( |
const std::string & |
name_) | |
|
Gets an int vector.
- Parameters
-
| name_ | : The table which contains the int vector. |
- Returns
- An int vector, containing all the ints inside the 'name_' array from the lua script.
| std::vector< std::string > LuaScript::unlua_getTableKeys |
( |
const std::string & |
name_) | |
|
Gets the keys from a table.
- Parameters
-
| name_ | : The name of the table. |
- Returns
- A string vector, containing all the keys from inside the 'name_' table from the lua script.
| bool LuaScript::unlua_getToStack |
( |
const std::string & |
variableName_) | |
|
|
private |
Validates existance of the variable.
Checks where the 'variableName_' variable exists inside the lua script.
- Parameters
-
| variableName_ | : The varaible you want to get a value from. |
- Returns
- True for success, false for failure to get variable.
template<typename T >
| T LuaScript::unlua_getValue |
( |
const std::string & |
variableName_) | |
|
|
private |
Gets a T type value from lua script.
- Parameters
-
| variableName_ | : The varaible you want to get a value from. |
- Returns
- T type value.
| lua_State* LuaScript::luaState |
|
private |
The documentation for this class was generated from the following files:
- /home/caio/Git/Dauphine/include/LuaScript.h
- /home/caio/Git/Dauphine/src/LuaScript.cpp