]> git.r.bdr.sh - rbdr/pico-engine/blame_incremental - LuaRestoreStack.h
Update project so it compiles
[rbdr/pico-engine] / LuaRestoreStack.h
... / ...
CommitLineData
1// ---------------------------------------------------------------------------\r
2// FILE NAME : LuaRestoreStack.h\r
3// ---------------------------------------------------------------------------\r
4// DESCRIPTION :\r
5//\r
6// Restores the Lua stack to the way we found it :)\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_RESTORE_STACK_H__\r
15#define __LUA_RESTORE_STACK_H__\r
16\r
17#include "luainc.h"\r
18\r
19class CLuaRestoreStack\r
20{\r
21public:\r
22 CLuaRestoreStack (CLuaVirtualMachine& vm) : m_pState (NULL)\r
23 {\r
24 m_pState = (lua_State *) vm;\r
25 if (vm.Ok ())\r
26 {\r
27 m_iTop = lua_gettop (m_pState);\r
28 }\r
29 }\r
30\r
31 virtual ~CLuaRestoreStack (void)\r
32 {\r
33 lua_settop (m_pState, m_iTop);\r
34 }\r
35\r
36protected:\r
37 lua_State *m_pState;\r
38 int m_iTop;\r
39};\r
40\r
41\r
42#endif // __LUA_RESTORE_STACK_H__