| 18436 | |
| 18437 | template <typename T> |
| 18438 | static void set_default_handler(lua_State* L, const T& ref) { |
| 18439 | if (L == nullptr) { |
| 18440 | return; |
| 18441 | } |
| 18442 | if (!ref.valid()) { |
| 18443 | #if defined(SOL_SAFE_STACK_CHECK) && SOL_SAFE_STACK_CHECK |
| 18444 | luaL_checkstack(L, 1, detail::not_enough_stack_space_generic); |
| 18445 | #endif // make sure stack doesn't overflow |
| 18446 | lua_pushnil(L); |
| 18447 | lua_setglobal(L, default_handler_name()); |
| 18448 | } |
| 18449 | else { |
| 18450 | ref.push(L); |
| 18451 | lua_setglobal(L, default_handler_name()); |
| 18452 | } |
| 18453 | } |
| 18454 | } // namespace detail |
| 18455 | } // namespace sol |
| 18456 |
no test coverage detected