|
Lib
QOLを高める
|
Lua state manager. More...
#include <script.h>
Classes | |
| struct | doNothing |
Public Member Functions | |
| Lua (bool debugEnable, size_t maxHeapSize, size_t initHeapSize=1024 *1024, int instLimit=10 *10000) | |
| Create new lua_State and open standard libs. More... | |
| ~Lua () | |
| Destruct lua_State. More... | |
| lua_State * | getLuaState () const |
| Returns lua_State which this object has. More... | |
| void | loadTraceLib () |
| void | loadSysLib () |
| void | loadRandLib () |
| void | loadResourceLib (framework::Application *app) |
| void | loadGraphLib (framework::Application *app) |
| void | loadSoundLib (framework::Application *app) |
| void | loadFile (const wchar_t *fileName, bool autoBreak, bool prot=true) |
| Load script file and eval it. More... | |
| template<class ParamFunc = doNothing, class RetFunc = doNothing> | |
| void | callGlobal (const char *funcName, bool autoBreak, ParamFunc pushArgFunc=doNothing(), int narg=0, RetFunc getRetFunc=doNothing(), int nret=0) |
| Calls global function. More... | |
Lua state manager.
Each Lua object manages one lua_State. If debugEnable at the constructor is true, full debug hook will be enabled. This may be heavy. If debugEnable is false, debug hook mask is only instruction count. instLimit is a feature for preventing infinite loop. LuaDebugger set it as hook count, and if COUNT event would happened, hook function raises an lua error.
| yappy::lua::Lua::Lua | ( | bool | debugEnable, |
| size_t | maxHeapSize, | ||
| size_t | initHeapSize = 1024 * 1024, |
||
| int | instLimit = 10 * 10000 |
||
| ) |
Create new lua_State and open standard libs.
| [in] | debugEnable | Enable debug feature. |
| [in] | maxHeapSize | Max memory usage. (only virtual address range will be reserved at first) |
| [in] | initHeapSize | Initial commit size. (physical memory mapped) |
| [in] | instLimit | Lua bytecode instruction count limit. (no limit if 0) |
Definition at line 102 of file script.cpp.
| yappy::lua::Lua::~Lua | ( | ) |
Destruct lua_State.
Definition at line 144 of file script.cpp.
|
inline |
Calls global function.
pushParamFunc and getRetFunc must be able to be called by:
(lambda expr is recommended)
| [in] | funcName | Function name. |
| [in] | autoBreak | Break by debugger at the first LINE event if true. |
| [in] | pushArgFunc | Will be called just before lua_pcall(). |
| [in] | narg | Arguments count. |
| [in] | getRetFunc | Will be called just after lua_pcall(). |
| [in] | nret | Return values count. |
| lua_State * yappy::lua::Lua::getLuaState | ( | ) | const |
Returns lua_State which this object has.
Definition at line 139 of file script.cpp.
| void yappy::lua::Lua::loadFile | ( | const wchar_t * | fileName, |
| bool | autoBreak, | ||
| bool | prot = true |
||
| ) |
Load script file and eval it.
| [in] | fileName | Script file name. |
| [in] | autoBreak | Debug break at the first line. |
| [in] | prot | Use pcall() if true. (false is include from Lua only) |
Definition at line 207 of file script.cpp.
| void yappy::lua::Lua::loadGraphLib | ( | framework::Application * | app | ) |
Definition at line 187 of file script.cpp.
| void yappy::lua::Lua::loadRandLib | ( | ) |
Definition at line 170 of file script.cpp.
| void yappy::lua::Lua::loadResourceLib | ( | framework::Application * | app | ) |
Definition at line 177 of file script.cpp.
| void yappy::lua::Lua::loadSoundLib | ( | framework::Application * | app | ) |
Definition at line 197 of file script.cpp.
| void yappy::lua::Lua::loadSysLib | ( | ) |
Definition at line 160 of file script.cpp.
| void yappy::lua::Lua::loadTraceLib | ( | ) |
Definition at line 149 of file script.cpp.
1.8.11