diff --git a/Cargo.lock b/Cargo.lock index 071f4c1..891ebb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ [[package]] name = "gmod" -version = "16.0.1" +version = "16.0.2" dependencies = [ "cfg_table", "cstr", diff --git a/gmod/Cargo.toml b/gmod/Cargo.toml index 51bb8cc..81e9346 100644 --- a/gmod/Cargo.toml +++ b/gmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gmod" -version = "16.0.1" +version = "16.0.2" authors = ["William Venner "] edition = "2021" license = "MIT" diff --git a/gmod/src/lua/lua_state.rs b/gmod/src/lua/lua_state.rs index 7ff8257..f7c666d 100644 --- a/gmod/src/lua/lua_state.rs +++ b/gmod/src/lua/lua_state.rs @@ -132,10 +132,21 @@ impl LuaState { } #[inline(always)] + /// You may be looking for `is_none_or_nil` pub unsafe fn is_nil(&self, index: i32) -> bool { (LUA_SHARED.lua_type)(*self, index) == LUA_TNIL } + #[inline(always)] + pub unsafe fn is_none(&self, index: i32) -> bool { + (LUA_SHARED.lua_type)(*self, index) == LUA_TNONE + } + + #[inline(always)] + pub unsafe fn is_none_or_nil(&self, index: i32) -> bool { + self.is_nil(index) || self.is_none(index) + } + #[inline(always)] pub unsafe fn is_function(&self, index: i32) -> bool { (LUA_SHARED.lua_type)(*self, index) == LUA_TFUNCTION