From 090c834f2cc954458ad8a22bd45a08898b42eb7c Mon Sep 17 00:00:00 2001 From: ThePhD Date: Wed, 7 Jun 2017 11:02:47 -0400 Subject: [PATCH] Let nullptr pass through, but we still can't do a conversion from `lua_nil` to `unique_usertype`s. --- sol/stack_push.hpp | 2 -- sol/types.hpp | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sol/stack_push.hpp b/sol/stack_push.hpp index 3ed75888..17909eb6 100644 --- a/sol/stack_push.hpp +++ b/sol/stack_push.hpp @@ -143,8 +143,6 @@ namespace sol { template >> = meta::enabler> static int push(lua_State* L, Arg&& arg) { - if (unique_usertype_traits::is_null(arg)) - return stack::push(L, lua_nil); return push_deep(L, std::forward(arg)); } diff --git a/sol/types.hpp b/sol/types.hpp index 85137683..6427a39c 100644 --- a/sol/types.hpp +++ b/sol/types.hpp @@ -562,7 +562,7 @@ namespace sol { return static_cast(lua_type(L, index)); } - inline int type_panic(lua_State* L, int index, type expected, type actual) { + inline int type_panic(lua_State* L, int index, type expected, type actual) noexcept(false) { return luaL_error(L, "stack index %d, expected %s, received %s", index, expected == type::poly ? "anything" : lua_typename(L, static_cast(expected)), expected == type::poly ? "anything" : lua_typename(L, static_cast(actual)) @@ -574,15 +574,15 @@ namespace sol { return 0; } - inline void type_error(lua_State* L, int expected, int actual) { + inline void type_error(lua_State* L, int expected, int actual) noexcept(false) { luaL_error(L, "expected %s, received %s", lua_typename(L, expected), lua_typename(L, actual)); } - inline void type_error(lua_State* L, type expected, type actual) { + inline void type_error(lua_State* L, type expected, type actual) noexcept(false) { type_error(L, static_cast(expected), static_cast(actual)); } - inline void type_assert(lua_State* L, int index, type expected, type actual) { + inline void type_assert(lua_State* L, int index, type expected, type actual) noexcept(false) { if (expected != type::poly && expected != actual) { type_panic(L, index, expected, actual); }