Last change
on this file since 8261 was
8061,
checked in by bensch, 19 years ago
|
merged the scriptengine back to the trunk
|
File size:
1.0 KB
|
Rev | Line | |
---|
[7645] | 1 | #ifndef __LUA_VIRTUAL_MACHINE_H__ |
---|
| 2 | #define __LUA_VIRTUAL_MACHINE_H__ |
---|
| 3 | |
---|
| 4 | #include <string> |
---|
| 5 | |
---|
[7655] | 6 | struct lua_State; |
---|
[7653] | 7 | namespace OrxScript |
---|
[7645] | 8 | { |
---|
[7653] | 9 | class LuaVirtualMachine |
---|
| 10 | { |
---|
[7645] | 11 | public: |
---|
| 12 | LuaVirtualMachine (void); |
---|
| 13 | virtual ~LuaVirtualMachine (void); |
---|
| 14 | |
---|
| 15 | bool init(void); |
---|
| 16 | bool destroy (void); |
---|
| 17 | |
---|
[7653] | 18 | // Load and run script elements |
---|
[7645] | 19 | bool runFile (const std::string& strFilename); |
---|
| 20 | bool runBuffer (const unsigned char *pbBuffer, size_t szLen, const char *strName = NULL); |
---|
| 21 | |
---|
[7653] | 22 | // C-Api into script |
---|
[7645] | 23 | bool callFunction (int nArgs, int nReturns = 0); |
---|
| 24 | |
---|
[7653] | 25 | // Get the state of the lua stack (use the cast operator) |
---|
[7654] | 26 | lua_State* getState (void) const{ return luaState; } |
---|
| 27 | operator lua_State* (void) const { return luaState; } |
---|
[7645] | 28 | |
---|
| 29 | static void panic (lua_State *lua); |
---|
| 30 | |
---|
[7653] | 31 | // Check if the VM is OK and can be used still |
---|
[7645] | 32 | virtual bool isOk (void) { return machineIsOk; } |
---|
| 33 | |
---|
[7653] | 34 | // For debugging |
---|
[7645] | 35 | //void AttachDebugger (CLuaDebugger *dbg) { m_pDbg = dbg; } |
---|
| 36 | |
---|
| 37 | protected: |
---|
| 38 | lua_State* luaState; |
---|
| 39 | bool machineIsOk; |
---|
[7653] | 40 | // CLuaDebugger *m_pDbg; |
---|
| 41 | }; |
---|
| 42 | } |
---|
[7645] | 43 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.