OpenMiner  0.0.1a
Voxel game engine
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
sol::basic_protected_function< base_t, aligned, handler_t > Class Template Reference

#include <sol.hpp>

Inheritance diagram for sol::basic_protected_function< base_t, aligned, handler_t >:
base_t

Public Types

typedef is_stack_based< handler_t > is_stack_handler
 

Public Member Functions

 basic_protected_function ()=default
 
template<typename T , meta::enable< meta::neg< std::is_same< meta::unqualified_t< T >, basic_protected_function >>, meta::neg< std::is_base_of< proxy_base_tag, meta::unqualified_t< T >>>, meta::neg< std::is_same< base_t, stack_reference >>, meta::neg< std::is_same< lua_nil_t, meta::unqualified_t< T >>>, is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
 basic_protected_function (T &&r) noexcept
 
 basic_protected_function (const basic_protected_function &)=default
 
basic_protected_functionoperator= (const basic_protected_function &)=default
 
 basic_protected_function (basic_protected_function &&)=default
 
basic_protected_functionoperator= (basic_protected_function &&)=default
 
 basic_protected_function (const basic_function< base_t > &b)
 
 basic_protected_function (basic_function< base_t > &&b)
 
 basic_protected_function (const basic_function< base_t > &b, handler_t eh)
 
 basic_protected_function (basic_function< base_t > &&b, handler_t eh)
 
 basic_protected_function (const stack_reference &r)
 
 basic_protected_function (stack_reference &&r)
 
 basic_protected_function (const stack_reference &r, handler_t eh)
 
 basic_protected_function (stack_reference &&r, handler_t eh)
 
template<typename Super >
 basic_protected_function (const proxy_base< Super > &p)
 
template<typename Super >
 basic_protected_function (proxy_base< Super > &&p)
 
template<typename Proxy , typename Handler , meta::enable< std::is_base_of< proxy_base_tag, meta::unqualified_t< Proxy >>, meta::neg< is_lua_index< meta::unqualified_t< Handler >>>> = meta::enabler>
 basic_protected_function (Proxy &&p, Handler &&eh)
 
template<typename T , meta::enable< is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
 basic_protected_function (lua_State *L, T &&r)
 
template<typename T , meta::enable< is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
 basic_protected_function (lua_State *L, T &&r, handler_t eh)
 
 basic_protected_function (lua_nil_t n)
 
 basic_protected_function (lua_State *L, int index=-1)
 
 basic_protected_function (lua_State *L, int index, handler_t eh)
 
 basic_protected_function (lua_State *L, absolute_index index)
 
 basic_protected_function (lua_State *L, absolute_index index, handler_t eh)
 
 basic_protected_function (lua_State *L, raw_index index)
 
 basic_protected_function (lua_State *L, raw_index index, handler_t eh)
 
 basic_protected_function (lua_State *L, ref_index index)
 
 basic_protected_function (lua_State *L, ref_index index, handler_t eh)
 
template<typename... Args>
protected_function_result operator() (Args &&... args) const
 
template<typename... Ret, typename... Args>
decltype(auto) operator() (types< Ret... >, Args &&... args) const
 
template<typename... Ret, typename... Args>
decltype(auto) call (Args &&... args) const
 

Static Public Member Functions

static handler_t get_default_handler (lua_State *L)
 
template<typename T >
static void set_default_handler (const T &ref)
 

Public Attributes

handler_t error_handler
 

Private Member Functions

template<bool b>
call_status luacall (std::ptrdiff_t argcount, std::ptrdiff_t resultcount, detail::protected_handler< b, handler_t > &h) const
 
template<std::size_t... I, bool b, typename... Ret>
auto invoke (types< Ret... >, std::index_sequence< I... >, std::ptrdiff_t n, detail::protected_handler< b, handler_t > &h) const
 
template<std::size_t I, bool b, typename Ret >
Ret invoke (types< Ret >, std::index_sequence< I >, std::ptrdiff_t n, detail::protected_handler< b, handler_t > &h) const
 
template<std::size_t I, bool b>
void invoke (types< void >, std::index_sequence< I >, std::ptrdiff_t n, detail::protected_handler< b, handler_t > &h) const
 
template<bool b>
protected_function_result invoke (types<>, std::index_sequence<>, std::ptrdiff_t n, detail::protected_handler< b, handler_t > &h) const
 

Member Typedef Documentation

§ is_stack_handler

template<typename base_t , bool aligned = false, typename handler_t = reference>
typedef is_stack_based<handler_t> sol::basic_protected_function< base_t, aligned, handler_t >::is_stack_handler

Constructor & Destructor Documentation

§ basic_protected_function() [1/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( )
default

§ basic_protected_function() [2/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename T , meta::enable< meta::neg< std::is_same< meta::unqualified_t< T >, basic_protected_function >>, meta::neg< std::is_base_of< proxy_base_tag, meta::unqualified_t< T >>>, meta::neg< std::is_same< base_t, stack_reference >>, meta::neg< std::is_same< lua_nil_t, meta::unqualified_t< T >>>, is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( T &&  r)
inlinenoexcept
15239  : base_t(std::forward<T>(r)), error_handler(get_default_handler(r.lua_state())) {
15240 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15241  if (!is_function<meta::unqualified_t<T>>::value) {
15242  auto pp = stack::push_pop(*this);
15243  constructor_handler handler{};
15244  stack::check<basic_protected_function>(lua_state(), -1, handler);
15245  }
15246 #endif // Safety
15247  }
handler_t error_handler
Definition: sol.hpp:15234
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135
push_popper< top_level, T > push_pop(T &&x)
Definition: sol.hpp:6661

§ basic_protected_function() [3/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const basic_protected_function< base_t, aligned, handler_t > &  )
default

§ basic_protected_function() [4/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( basic_protected_function< base_t, aligned, handler_t > &&  )
default

§ basic_protected_function() [5/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const basic_function< base_t > &  b)
inline
15253  : basic_protected_function(b, get_default_handler(b.lua_state())) {
15254  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [6/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( basic_function< base_t > &&  b)
inline
15256  : basic_protected_function(std::move(b), get_default_handler(b.lua_state())) {
15257  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [7/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const basic_function< base_t > &  b,
handler_t  eh 
)
inline
15259  : base_t(b), error_handler(std::move(eh)) {
15260  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [8/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( basic_function< base_t > &&  b,
handler_t  eh 
)
inline
15262  : base_t(std::move(b)), error_handler(std::move(eh)) {
15263  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [9/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const stack_reference r)
inline
15265  : basic_protected_function(r.lua_state(), r.stack_index(), get_default_handler(r.lua_state())) {
15266  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [10/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( stack_reference &&  r)
inline
15268  : basic_protected_function(r.lua_state(), r.stack_index(), get_default_handler(r.lua_state())) {
15269  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [11/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const stack_reference r,
handler_t  eh 
)
inline
15271  : basic_protected_function(r.lua_state(), r.stack_index(), std::move(eh)) {
15272  }

§ basic_protected_function() [12/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( stack_reference &&  r,
handler_t  eh 
)
inline
15274  : basic_protected_function(r.lua_state(), r.stack_index(), std::move(eh)) {
15275  }

§ basic_protected_function() [13/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename Super >
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( const proxy_base< Super > &  p)
inline
15279  : basic_protected_function(p, get_default_handler(p.lua_state())) {
15280  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [14/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename Super >
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( proxy_base< Super > &&  p)
inline
15283  : basic_protected_function(std::move(p), get_default_handler(p.lua_state())) {
15284  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [15/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename Proxy , typename Handler , meta::enable< std::is_base_of< proxy_base_tag, meta::unqualified_t< Proxy >>, meta::neg< is_lua_index< meta::unqualified_t< Handler >>>> = meta::enabler>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( Proxy &&  p,
Handler &&  eh 
)
inline
15287  : basic_protected_function(detail::force_cast<base_t>(p), std::forward<Handler>(eh)) {
15288  }

§ basic_protected_function() [16/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename T , meta::enable< is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
T &&  r 
)
inline
15292  : basic_protected_function(L, std::forward<T>(r), get_default_handler(L)) {
15293  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [17/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename T , meta::enable< is_lua_reference< meta::unqualified_t< T >>> = meta::enabler>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
T &&  r,
handler_t  eh 
)
inline
15296  : base_t(L, std::forward<T>(r)), error_handler(std::move(eh)) {
15297 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15298  auto pp = stack::push_pop(*this);
15299  constructor_handler handler{};
15300  stack::check<basic_protected_function>(lua_state(), -1, handler);
15301 #endif // Safety
15302  }
handler_t error_handler
Definition: sol.hpp:15234
push_popper< top_level, T > push_pop(T &&x)
Definition: sol.hpp:6661

§ basic_protected_function() [18/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_nil_t  n)
inline
15305  : base_t(n), error_handler(n) {
15306  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [19/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
int  index = -1 
)
inline
15310  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [20/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
int  index,
handler_t  eh 
)
inline
15312  : base_t(L, index), error_handler(std::move(eh)) {
15313 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15314  constructor_handler handler{};
15315  stack::check<basic_protected_function>(L, index, handler);
15316 #endif // Safety
15317  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [21/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
absolute_index  index 
)
inline
15320  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [22/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
absolute_index  index,
handler_t  eh 
)
inline
15322  : base_t(L, index), error_handler(std::move(eh)) {
15323 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15324  constructor_handler handler{};
15325  stack::check<basic_protected_function>(L, index, handler);
15326 #endif // Safety
15327  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [23/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
raw_index  index 
)
inline
15330  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [24/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
raw_index  index,
handler_t  eh 
)
inline
15332  : base_t(L, index), error_handler(std::move(eh)) {
15333 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15334  constructor_handler handler{};
15335  stack::check<basic_protected_function>(L, index, handler);
15336 #endif // Safety
15337  }
handler_t error_handler
Definition: sol.hpp:15234

§ basic_protected_function() [25/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
ref_index  index 
)
inline
15340  }
static handler_t get_default_handler(lua_State *L)
Definition: sol.hpp:15135

§ basic_protected_function() [26/26]

template<typename base_t , bool aligned = false, typename handler_t = reference>
sol::basic_protected_function< base_t, aligned, handler_t >::basic_protected_function ( lua_State *  L,
ref_index  index,
handler_t  eh 
)
inline
15342  : base_t(L, index), error_handler(std::move(eh)) {
15343 #if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
15344  auto pp = stack::push_pop(*this);
15345  constructor_handler handler{};
15346  stack::check<basic_protected_function>(lua_state(), -1, handler);
15347 #endif // Safety
15348  }
handler_t error_handler
Definition: sol.hpp:15234
push_popper< top_level, T > push_pop(T &&x)
Definition: sol.hpp:6661

Member Function Documentation

§ call()

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename... Ret, typename... Args>
decltype(auto) sol::basic_protected_function< base_t, aligned, handler_t >::call ( Args &&...  args) const
inline
15361  {
15362  if (!aligned) {
15363  // we do not expect the function to already be on the stack: push it
15364  if (error_handler.valid()) {
15365  detail::protected_handler<true, handler_t> h(error_handler);
15366  base_t::push();
15367  int pushcount = stack::multi_push_reference(lua_state(), std::forward<Args>(args)...);
15368  return invoke(types<Ret...>(), std::make_index_sequence<sizeof...(Ret)>(), pushcount, h);
15369  }
15370  else {
15371  detail::protected_handler<false, handler_t> h(error_handler);
15372  base_t::push();
15373  int pushcount = stack::multi_push_reference(lua_state(), std::forward<Args>(args)...);
15374  return invoke(types<Ret...>(), std::make_index_sequence<sizeof...(Ret)>(), pushcount, h);
15375  }
15376  }
15377  else {
15378  // the function is already on the stack at the right location
15379  if (error_handler.valid()) {
15380  // the handler will be pushed onto the stack manually,
15381  // since it's not already on the stack this means we need to push our own
15382  // function on the stack too and swap things to be in-place
15383  if (!is_stack_handler::value) {
15384  // so, we need to remove the function at the top and then dump the handler out ourselves
15385  base_t::push();
15386  }
15387  detail::protected_handler<true, handler_t> h(error_handler);
15388  if (!is_stack_handler::value) {
15389  lua_replace(lua_state(), -3);
15390  h.stackindex = lua_absindex(lua_state(), -2);
15391  }
15392  int pushcount = stack::multi_push_reference(lua_state(), std::forward<Args>(args)...);
15393  return invoke(types<Ret...>(), std::make_index_sequence<sizeof...(Ret)>(), pushcount, h);
15394  }
15395  else {
15396  detail::protected_handler<false, handler_t> h(error_handler);
15397  int pushcount = stack::multi_push_reference(lua_state(), std::forward<Args>(args)...);
15398  return invoke(types<Ret...>(), std::make_index_sequence<sizeof...(Ret)>(), pushcount, h);
15399  }
15400  }
15401  }
handler_t error_handler
Definition: sol.hpp:15234
int multi_push_reference(lua_State *)
Definition: sol.hpp:7802
auto invoke(types< Ret... >, std::index_sequence< I... >, std::ptrdiff_t n, detail::protected_handler< b, handler_t > &h) const
Definition: sol.hpp:15151
int push(lua_State *L, Arg &&arg, Args &&... args)
Definition: sol.hpp:7776

§ get_default_handler()

template<typename base_t , bool aligned = false, typename handler_t = reference>
static handler_t sol::basic_protected_function< base_t, aligned, handler_t >::get_default_handler ( lua_State *  L)
inlinestatic
15135  {
15136  return detail::get_default_handler<handler_t, is_main_threaded<base_t>::value>(L);
15137  }

§ invoke() [1/4]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<std::size_t... I, bool b, typename... Ret>
auto sol::basic_protected_function< base_t, aligned, handler_t >::invoke ( types< Ret... >  ,
std::index_sequence< I... >  ,
std::ptrdiff_t  n,
detail::protected_handler< b, handler_t > &  h 
) const
inlineprivate
15151  {
15152  luacall(n, sizeof...(Ret), h);
15153  return stack::pop<std::tuple<Ret...>>(lua_state());
15154  }
call_status luacall(std::ptrdiff_t argcount, std::ptrdiff_t resultcount, detail::protected_handler< b, handler_t > &h) const
Definition: sol.hpp:15146
decltype(auto) pop(lua_State *L)
Definition: sol.hpp:8064

§ invoke() [2/4]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<std::size_t I, bool b, typename Ret >
Ret sol::basic_protected_function< base_t, aligned, handler_t >::invoke ( types< Ret >  ,
std::index_sequence< I >  ,
std::ptrdiff_t  n,
detail::protected_handler< b, handler_t > &  h 
) const
inlineprivate
15157  {
15158  luacall(n, 1, h);
15159  return stack::pop<Ret>(lua_state());
15160  }
call_status luacall(std::ptrdiff_t argcount, std::ptrdiff_t resultcount, detail::protected_handler< b, handler_t > &h) const
Definition: sol.hpp:15146

§ invoke() [3/4]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<std::size_t I, bool b>
void sol::basic_protected_function< base_t, aligned, handler_t >::invoke ( types< void >  ,
std::index_sequence< I >  ,
std::ptrdiff_t  n,
detail::protected_handler< b, handler_t > &  h 
) const
inlineprivate
15163  {
15164  luacall(n, 0, h);
15165  }
call_status luacall(std::ptrdiff_t argcount, std::ptrdiff_t resultcount, detail::protected_handler< b, handler_t > &h) const
Definition: sol.hpp:15146

§ invoke() [4/4]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<bool b>
protected_function_result sol::basic_protected_function< base_t, aligned, handler_t >::invoke ( types<>  ,
std::index_sequence<>  ,
std::ptrdiff_t  n,
detail::protected_handler< b, handler_t > &  h 
) const
inlineprivate
15168  {
15169  int stacksize = lua_gettop(lua_state());
15170  int poststacksize = stacksize;
15171  int firstreturn = 1;
15172  int returncount = 0;
15174 #if !defined(SOL_NO_EXCEPTIONS) || !SOL_NO_EXCEPTIONS
15175  auto onexcept = [&](optional<const std::exception&> maybe_ex, const char* error) {
15176  h.stackindex = 0;
15177  if (b) {
15178  h.target.push();
15179  detail::call_exception_handler(lua_state(), maybe_ex, error);
15180  lua_call(lua_state(), 1, 1);
15181  }
15182  else {
15183  detail::call_exception_handler(lua_state(), maybe_ex, error);
15184  }
15185  };
15186  (void)onexcept;
15187 #if (!defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || !SOL_NO_EXCEPTIONS_SAFE_PROPAGATION) || (defined(SOL_LUAJIT) && SOL_LUAJIT)
15188  try {
15189 #endif // Safe Exception Propagation
15190 #endif // No Exceptions
15191  firstreturn = (std::max)(1, static_cast<int>(stacksize - n - static_cast<int>(h.valid())));
15192  code = luacall(n, LUA_MULTRET, h);
15193  poststacksize = lua_gettop(lua_state()) - static_cast<int>(h.valid());
15194  returncount = poststacksize - (firstreturn - 1);
15195 #ifndef SOL_NO_EXCEPTIONS
15196 #if (!defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || !SOL_NO_EXCEPTIONS_SAFE_PROPAGATION) || (defined(SOL_LUAJIT) && SOL_LUAJIT)
15197  }
15198  // Handle C++ errors thrown from C++ functions bound inside of lua
15199  catch (const char* error) {
15200  onexcept(optional<const std::exception&>(nullopt), error);
15201  firstreturn = lua_gettop(lua_state());
15202  return protected_function_result(lua_state(), firstreturn, 0, 1, call_status::runtime);
15203  }
15204  catch (const std::string& error) {
15205  onexcept(optional<const std::exception&>(nullopt), error.c_str());
15206  firstreturn = lua_gettop(lua_state());
15207  return protected_function_result(lua_state(), firstreturn, 0, 1, call_status::runtime);
15208  }
15209  catch (const std::exception& error) {
15210  onexcept(optional<const std::exception&>(error), error.what());
15211  firstreturn = lua_gettop(lua_state());
15212  return protected_function_result(lua_state(), firstreturn, 0, 1, call_status::runtime);
15213  }
15214 #if (!defined(SOL_EXCEPTIONS_SAFE_PROPAGATION) || !SOL_NO_EXCEPTIONS_SAFE_PROPAGATION)
15215  // LuaJIT cannot have the catchall when the safe propagation is on
15216  // but LuaJIT will swallow all C++ errors
15217  // if we don't at least catch std::exception ones
15218  catch (...) {
15219  onexcept(optional<const std::exception&>(nullopt), "caught (...) unknown error during protected_function call");
15220  firstreturn = lua_gettop(lua_state());
15221  return protected_function_result(lua_state(), firstreturn, 0, 1, call_status::runtime);
15222  }
15223 #endif // LuaJIT
15224 #else
15225  // do not handle exceptions: they can be propogated into C++ and keep all type information / rich information
15226 #endif // Safe Exception Propagation
15227 #endif // Exceptions vs. No Exceptions
15228  return protected_function_result(lua_state(), firstreturn, returncount, returncount, code);
15229  }
call_status luacall(std::ptrdiff_t argcount, std::ptrdiff_t resultcount, detail::protected_handler< b, handler_t > &h) const
Definition: sol.hpp:15146
int call_exception_handler(lua_State *L, optional< const std::exception &> maybe_ex, string_view what)
Definition: sol.hpp:5850
call_status
Definition: sol.hpp:5144
constexpr nullopt_t nullopt
Definition: sol.hpp:3498

§ luacall()

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<bool b>
call_status sol::basic_protected_function< base_t, aligned, handler_t >::luacall ( std::ptrdiff_t  argcount,
std::ptrdiff_t  resultcount,
detail::protected_handler< b, handler_t > &  h 
) const
inlineprivate
15146  {
15147  return static_cast<call_status>(lua_pcall(lua_state(), static_cast<int>(argcount), static_cast<int>(resultcount), h.stackindex));
15148  }
call_status
Definition: sol.hpp:5144

§ operator()() [1/2]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename... Args>
protected_function_result sol::basic_protected_function< base_t, aligned, handler_t >::operator() ( Args &&...  args) const
inline
15351  {
15352  return call<>(std::forward<Args>(args)...);
15353  }

§ operator()() [2/2]

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename... Ret, typename... Args>
decltype(auto) sol::basic_protected_function< base_t, aligned, handler_t >::operator() ( types< Ret... >  ,
Args &&...  args 
) const
inline
15356  {
15357  return call<Ret...>(std::forward<Args>(args)...);
15358  }
decltype(auto) call(Args &&... args) const
Definition: sol.hpp:15361

§ operator=() [1/2]

template<typename base_t , bool aligned = false, typename handler_t = reference>
basic_protected_function& sol::basic_protected_function< base_t, aligned, handler_t >::operator= ( const basic_protected_function< base_t, aligned, handler_t > &  )
default

§ operator=() [2/2]

template<typename base_t , bool aligned = false, typename handler_t = reference>
basic_protected_function& sol::basic_protected_function< base_t, aligned, handler_t >::operator= ( basic_protected_function< base_t, aligned, handler_t > &&  )
default

§ set_default_handler()

template<typename base_t , bool aligned = false, typename handler_t = reference>
template<typename T >
static void sol::basic_protected_function< base_t, aligned, handler_t >::set_default_handler ( const T ref)
inlinestatic
15140  {
15141  detail::set_default_handler(ref.lua_state(), ref);
15142  }
static void set_default_handler(lua_State *L, const T &ref)
Definition: sol.hpp:15111

Member Data Documentation

§ error_handler

template<typename base_t , bool aligned = false, typename handler_t = reference>
handler_t sol::basic_protected_function< base_t, aligned, handler_t >::error_handler

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