mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
12 lines
283 B
C++
12 lines
283 B
C++
|
#pragma once
|
||
|
|
||
|
struct stack_guard {
|
||
|
lua_State* L;
|
||
|
int& begintop;
|
||
|
int& endtop;
|
||
|
stack_guard(lua_State* L, int& begintop, int& endtop) : L(L), begintop(begintop), endtop(endtop) {
|
||
|
begintop = lua_gettop(L);
|
||
|
}
|
||
|
~stack_guard() { endtop = lua_gettop(L); }
|
||
|
};
|