Line | |
---|
1 | #ifndef __LUA_VIRTUAL_MACHINE_H__ |
---|
2 | #define __LUA_VIRTUAL_MACHINE_H__ |
---|
3 | |
---|
4 | #include <string> |
---|
5 | |
---|
6 | #include "luaincl.h" |
---|
7 | |
---|
8 | class LuaVirtualMachine |
---|
9 | { |
---|
10 | public: |
---|
11 | LuaVirtualMachine (void); |
---|
12 | virtual ~LuaVirtualMachine (void); |
---|
13 | |
---|
14 | bool init(void); |
---|
15 | bool destroy (void); |
---|
16 | |
---|
17 | // Load and run script elements |
---|
18 | bool runFile (const std::string& strFilename); |
---|
19 | bool runBuffer (const unsigned char *pbBuffer, size_t szLen, const char *strName = NULL); |
---|
20 | |
---|
21 | // C-Api into script |
---|
22 | bool callFunction (int nArgs, int nReturns = 0); |
---|
23 | |
---|
24 | // Get the state of the lua stack (use the cast operator) |
---|
25 | //lua_State *GetState (void) { return luaState; } |
---|
26 | operator lua_State *(void) { return luaState; } |
---|
27 | |
---|
28 | static void panic (lua_State *lua); |
---|
29 | |
---|
30 | // Check if the VM is OK and can be used still |
---|
31 | virtual bool isOk (void) { return machineIsOk; } |
---|
32 | |
---|
33 | // For debugging |
---|
34 | //void AttachDebugger (CLuaDebugger *dbg) { m_pDbg = dbg; } |
---|
35 | |
---|
36 | protected: |
---|
37 | lua_State* luaState; |
---|
38 | bool machineIsOk; |
---|
39 | // CLuaDebugger *m_pDbg; |
---|
40 | }; |
---|
41 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.