Add is_none and is_none_or_nil
This commit is contained in:
parent
9b3c37369b
commit
f0e1f92782
|
@ -109,7 +109,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gmod"
|
||||
version = "16.0.1"
|
||||
version = "16.0.2"
|
||||
dependencies = [
|
||||
"cfg_table",
|
||||
"cstr",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gmod"
|
||||
version = "16.0.1"
|
||||
version = "16.0.2"
|
||||
authors = ["William Venner <william@venner.io>"]
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue