]>
git.r.bdr.sh - rbdr/pico-engine/blob - LuaVirtualMachine.h
1 // ---------------------------------------------------------------------------
2 // FILE NAME : LuaVirtualMachine.h
3 // ---------------------------------------------------------------------------
6 // Lua virtual machine implementation
8 // ---------------------------------------------------------------------------
11 // AUTHOR : Richard Shephard
12 // ---------------------------------------------------------------------------
13 // LIBRARY INCLUDE FILES
14 #ifndef __LUA_VIRTUAL_MACHINE_H__
15 #define __LUA_VIRTUAL_MACHINE_H__
18 #include "LuaDebugger.h"
22 class CLuaVirtualMachine
25 CLuaVirtualMachine (void);
26 virtual ~CLuaVirtualMachine (void);
28 bool InitialiseVM (void);
29 bool DestroyVM (void);
31 // Load and run script elements
32 bool RunFile (const char *strFilename
);
33 bool RunBuffer (const unsigned char *pbBuffer
, size_t szLen
, const char *strName
= NULL
);
36 bool CallFunction (int nArgs
, int nReturns
= 0);
38 // Get the state of the lua stack (use the cast operator)
39 //lua_State *GetState (void) { return m_pState; }
40 operator lua_State
*(void) { return m_pState
; }
42 static void Panic (lua_State
*lua
);
44 // Check if the VM is OK and can be used still
45 virtual bool Ok (void) { return m_fIsOk
; }
48 void AttachDebugger (CLuaDebugger
*dbg
) { m_pDbg
= dbg
; }
57 #endif // __LUA_VIRTUAL_MACHINE_H__