123
This commit is contained in:
21
CryScriptSystem/StackGuard.h
Normal file
21
CryScriptSystem/StackGuard.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _STACKGUARD_H_
|
||||
#define _STACKGUARD_H_
|
||||
struct _StackGuard
|
||||
{
|
||||
_StackGuard(lua_State *p)
|
||||
{
|
||||
m_pLS=p;
|
||||
m_nTop=lua_gettop(m_pLS);
|
||||
}
|
||||
~_StackGuard()
|
||||
{
|
||||
lua_settop(m_pLS,m_nTop);
|
||||
}
|
||||
private:
|
||||
int m_nTop;
|
||||
lua_State *m_pLS;
|
||||
};
|
||||
|
||||
#define _GUARD_STACK(ls) _StackGuard __guard__(ls);
|
||||
|
||||
#endif _STACKGUARD_H_
|
||||
Reference in New Issue
Block a user