1 #pragma once 2 3 struct test_stack_guard { 4 lua_State* L; 5 int& begintop; 6 int& endtop; test_stack_guardtest_stack_guard7 test_stack_guard(lua_State* L, int& begintop, int& endtop) : L(L), begintop(begintop), endtop(endtop) { 8 begintop = lua_gettop(L); 9 } ~test_stack_guardtest_stack_guard10 ~test_stack_guard() { endtop = lua_gettop(L); } 11 }; 12