#include <LuaScript.hpp>
Collaboration diagram for BARE2D::LuaScriptContextWrapper:Public Member Functions | |
| LuaScriptContextWrapper () | |
| ~LuaScriptContextWrapper () | |
| void | init (lua_State *parentState, LuaScript *script) |
| Creates and initializes all the necessary bits. More... | |
| void | destroy () |
| Cleans up. More... | |
| void | start () |
| Starts the script. More... | |
| void | update () |
| Updates the script - decreases delay counter, checks if it is finished, etc. More... | |
| bool | isCompleted () |
| Returns m_completed. More... | |
Protected Member Functions | |
| void | loadLua (std::string &luaStr) |
| Loads and compiles the given Lua script. Also, sets m_scriptReference to the index of the compiled script in the registry. More... | |
| void | createThread () |
| Creates the m_state variable as a thread, or subroutine of the parent. More... | |
Protected Attributes | |
| lua_State * | m_state = nullptr |
| lua_State * | m_parent = nullptr |
| bool | m_yielded = false |
| unsigned int | m_remainingDelay = 0 |
| bool | m_completed = false |
| int | m_scriptReference = LUA_REFNIL |
| int | m_threadReference = LUA_REFNIL |
Definition at line 31 of file LuaScript.hpp.
| BARE2D::LuaScriptContextWrapper::LuaScriptContextWrapper | ( | ) |
Definition at line 15 of file LuaScript.cpp.
| BARE2D::LuaScriptContextWrapper::~LuaScriptContextWrapper | ( | ) |
Definition at line 18 of file LuaScript.cpp.
|
protected |
Creates the m_state variable as a thread, or subroutine of the parent.
Definition at line 32 of file LuaScript.cpp.
References BARE2D::LUA_FAILURE, m_parent, m_state, m_threadReference, and BARE2D::throwError().
Referenced by init().
Here is the call graph for this function:
Here is the caller graph for this function:| void BARE2D::LuaScriptContextWrapper::destroy | ( | ) |
Cleans up.
Definition at line 45 of file LuaScript.cpp.
References m_completed, and m_state.
Referenced by update().
Here is the caller graph for this function:| void BARE2D::LuaScriptContextWrapper::init | ( | lua_State * | parentState, |
| LuaScript * | script | ||
| ) |
Creates and initializes all the necessary bits.
| id | The ID of the script, which was assigned from the LuaScriptQueue |
| parentState | The masterstate, generally, although I suppose it could be others. |
Definition at line 21 of file LuaScript.cpp.
References createThread(), loadLua(), m_parent, and BARE2D::LuaScript::m_script.
Referenced by BARE2D::LuaScriptEngine::createLuaContext().
Here is the call graph for this function:
Here is the caller graph for this function:| bool BARE2D::LuaScriptContextWrapper::isCompleted | ( | ) |
|
protected |
Loads and compiles the given Lua script. Also, sets m_scriptReference to the index of the compiled script in the registry.
| luaStr | The script to compile. |
Definition at line 120 of file LuaScript.cpp.
References BARE2D::LUA_FAILURE, m_scriptReference, m_state, and BARE2D::throwError().
Referenced by init().
Here is the call graph for this function:
Here is the caller graph for this function:| void BARE2D::LuaScriptContextWrapper::start | ( | ) |
Starts the script.
Definition at line 56 of file LuaScript.cpp.
References BARE2D::LUA_FAILURE, m_scriptReference, m_state, and BARE2D::throwError().
Referenced by BARE2D::LuaScriptEngine::update().
Here is the call graph for this function:
Here is the caller graph for this function:| void BARE2D::LuaScriptContextWrapper::update | ( | ) |
Updates the script - decreases delay counter, checks if it is finished, etc.
Definition at line 80 of file LuaScript.cpp.
References destroy(), BARE2D::LUA_FAILURE, m_completed, m_remainingDelay, m_state, m_yielded, and BARE2D::throwError().
Here is the call graph for this function:
|
protected |
Definition at line 85 of file LuaScript.hpp.
Referenced by destroy(), isCompleted(), and update().
|
protected |
Definition at line 78 of file LuaScript.hpp.
Referenced by createThread(), and init().
|
protected |
Definition at line 82 of file LuaScript.hpp.
Referenced by update().
|
protected |
Definition at line 88 of file LuaScript.hpp.
|
protected |
Definition at line 76 of file LuaScript.hpp.
Referenced by createThread(), destroy(), loadLua(), start(), and update().
|
protected |
Definition at line 90 of file LuaScript.hpp.
Referenced by createThread().
|
protected |
Definition at line 81 of file LuaScript.hpp.
Referenced by update().