OpenMiner  0.0.1a
Voxel game engine
Public Member Functions | Public Attributes | List of all members
sol::stack_guard Struct Reference

#include <sol.hpp>

Public Member Functions

 stack_guard (lua_State *L)
 
 stack_guard (lua_State *L, int top, std::function< void(int, int)> fx=detail::stack_fail)
 
bool check_stack (int modification=0) const
 
 ~stack_guard ()
 

Public Attributes

lua_State * L
 
int top
 
std::function< void(int, int)> on_mismatch
 

Constructor & Destructor Documentation

§ stack_guard() [1/2]

sol::stack_guard::stack_guard ( lua_State *  L)
inline
7122  : stack_guard(L, lua_gettop(L)) {
7123  }
lua_State * L
Definition: sol.hpp:7117
stack_guard(lua_State *L)
Definition: sol.hpp:7121

§ stack_guard() [2/2]

sol::stack_guard::stack_guard ( lua_State *  L,
int  top,
std::function< void(int, int)>  fx = detail::stack_fail 
)
inline
7125  : L(L), top(top), on_mismatch(std::move(fx)) {
7126  }
int top
Definition: sol.hpp:7118
std::function< void(int, int)> on_mismatch
Definition: sol.hpp:7119
lua_State * L
Definition: sol.hpp:7117

§ ~stack_guard()

sol::stack_guard::~stack_guard ( )
inline
7135  {
7136  check_stack();
7137  }
bool check_stack(int modification=0) const
Definition: sol.hpp:7127

Member Function Documentation

§ check_stack()

bool sol::stack_guard::check_stack ( int  modification = 0) const
inline
7127  {
7128  int bottom = lua_gettop(L) + modification;
7129  if (top == bottom) {
7130  return true;
7131  }
7132  on_mismatch(top, bottom);
7133  return false;
7134  }
int top
Definition: sol.hpp:7118
std::function< void(int, int)> on_mismatch
Definition: sol.hpp:7119
lua_State * L
Definition: sol.hpp:7117

Member Data Documentation

§ L

lua_State* sol::stack_guard::L

§ on_mismatch

std::function<void(int, int)> sol::stack_guard::on_mismatch

§ top

int sol::stack_guard::top

The documentation for this struct was generated from the following file: