]> git.r.bdr.sh - rbdr/pico-engine/blame - LuaVirtualMachine.h
Update project so it compiles
[rbdr/pico-engine] / LuaVirtualMachine.h
CommitLineData
10a0e290
BB
1// ---------------------------------------------------------------------------\r
2// FILE NAME : LuaVirtualMachine.h\r
3// ---------------------------------------------------------------------------\r
4// DESCRIPTION :\r
5//\r
6// Lua virtual machine implementation\r
7// \r
8// ---------------------------------------------------------------------------\r
9// VERSION : 1.00\r
10// DATE : 1-Sep-2005\r
11// AUTHOR : Richard Shephard\r
12// ---------------------------------------------------------------------------\r
13// LIBRARY INCLUDE FILES\r
14#ifndef __LUA_VIRTUAL_MACHINE_H__\r
15#define __LUA_VIRTUAL_MACHINE_H__\r
16\r
17#include "luainc.h"\r
f631762a 18#include "LuaDebugger.h"\r
10a0e290
BB
19\r
20class CLuaDebugger;\r
21\r
22class CLuaVirtualMachine\r
23{\r
24public:\r
25 CLuaVirtualMachine (void);\r
26 virtual ~CLuaVirtualMachine (void);\r
27\r
28 bool InitialiseVM (void);\r
29 bool DestroyVM (void);\r
30\r
31 // Load and run script elements\r
32 bool RunFile (const char *strFilename);\r
33 bool RunBuffer (const unsigned char *pbBuffer, size_t szLen, const char *strName = NULL);\r
34\r
35 // C-Api into script\r
36 bool CallFunction (int nArgs, int nReturns = 0);\r
37\r
38 // Get the state of the lua stack (use the cast operator)\r
39 //lua_State *GetState (void) { return m_pState; }\r
40 operator lua_State *(void) { return m_pState; }\r
41\r
42 static void Panic (lua_State *lua);\r
43\r
44 // Check if the VM is OK and can be used still\r
45 virtual bool Ok (void) { return m_fIsOk; }\r
46\r
47 // For debugging\r
48 void AttachDebugger (CLuaDebugger *dbg) { m_pDbg = dbg; }\r
49\r
50protected:\r
51 lua_State *m_pState;\r
52 bool m_fIsOk;\r
53 CLuaDebugger *m_pDbg;\r
54};\r
55\r
56\r
f631762a 57#endif // __LUA_VIRTUAL_MACHINE_H__\r