24 lines
451 B
C++
24 lines
451 B
C++
#ifndef LUA_STACK_GUARD_H
|
|
#define LUA_STACK_GUARD_H
|
|
|
|
#include "lua.hpp"
|
|
|
|
namespace Util {
|
|
|
|
class LuaStackguard {
|
|
public:
|
|
LuaStackguard(const char* f, int l, lua_State *L);
|
|
~LuaStackguard();
|
|
private:
|
|
int m_top;
|
|
lua_State* m_state;
|
|
// line number and filename where this instance was created
|
|
int i_line;
|
|
const char* i_file;
|
|
};
|
|
|
|
#define LGUARD(L) LuaStackguard guard(__FILE__, __LINE__, L)
|
|
|
|
}
|
|
#endif
|