Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/script_engine: namespace OrxScript introduced

File size: 1.0 KB
Line 
1#ifndef __LUA_VIRTUAL_MACHINE_H__
2#define __LUA_VIRTUAL_MACHINE_H__
3
4#include <string>
5
6#include "luaincl.h"
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) { return luaState; }
27    operator lua_State *(void) { 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.