From a48b20b5fb9c718eb919d86ea81260ebb238ec9e Mon Sep 17 00:00:00 2001 From: satoren Date: Sun, 12 Jun 2016 05:43:26 +0900 Subject: [PATCH] Remove meaningless error --- include/kaguya/detail/lua_ref_impl.hpp | 1 - include/kaguya/lua_ref.hpp | 8 ++++---- include/kaguya/type.hpp | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/kaguya/detail/lua_ref_impl.hpp b/include/kaguya/detail/lua_ref_impl.hpp index 5ca7639..2ac7043 100644 --- a/include/kaguya/detail/lua_ref_impl.hpp +++ b/include/kaguya/detail/lua_ref_impl.hpp @@ -272,7 +272,6 @@ namespace kaguya if (!isNilref()) { luaL_unref(state_, LUA_REGISTRYINDEX, ref_); - state_ = 0; ref_ = LUA_REFNIL; } } diff --git a/include/kaguya/lua_ref.hpp b/include/kaguya/lua_ref.hpp index 129339a..151acd3 100644 --- a/include/kaguya/lua_ref.hpp +++ b/include/kaguya/lua_ref.hpp @@ -331,7 +331,7 @@ namespace kaguya void typecheck() { int t = type(); - if (t != TYPE_USERDATA && t != TYPE_NIL) + if (t != TYPE_USERDATA && t != TYPE_NIL && t != TYPE_NONE) { except::typeMismatchError(state(), "not user data"); Ref::RegistoryRef::unref(); @@ -395,7 +395,7 @@ namespace kaguya void typecheck() { int t = type(); - if (t != TYPE_TABLE && t != TYPE_NIL) + if (t != TYPE_TABLE && t != TYPE_NIL && t != TYPE_NONE) { except::typeMismatchError(state(), "not table"); Ref::RegistoryRef::unref(); @@ -458,7 +458,7 @@ namespace kaguya void typecheck() { int t = type(); - if (t != TYPE_FUNCTION && t != TYPE_NIL) + if (t != TYPE_FUNCTION && t != TYPE_NIL && t != TYPE_NONE) { except::typeMismatchError(state(), "not function"); RegistoryRef::unref(); @@ -656,7 +656,7 @@ namespace kaguya void typecheck() { int t = type(); - if (t != TYPE_THREAD && t != TYPE_NIL) + if (t != TYPE_THREAD && t != TYPE_NIL && t != TYPE_NONE) { except::typeMismatchError(state(), "not lua thread"); RegistoryRef::unref(); diff --git a/include/kaguya/type.hpp b/include/kaguya/type.hpp index 29ffa00..fc95e2e 100644 --- a/include/kaguya/type.hpp +++ b/include/kaguya/type.hpp @@ -688,6 +688,7 @@ namespace kaguya public: enum value_type { + TYPE_NONE = LUA_TNONE,//!< none type TYPE_NIL = LUA_TNIL,//!< nil type TYPE_BOOL = LUA_TBOOLEAN,//!< boolean type TYPE_LIGHTUSERDATA = LUA_TLIGHTUSERDATA,//!< light userdata type