Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/bsp_model/src/lib/script_engine/OLD/VirtualMachine.h @ 8453

Last change on this file since 8453 was 8061, checked in by bensch, 18 years ago

merged the scriptengine back to the trunk

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