Add is_none and is_none_or_nil
This commit is contained in:
parent
9b3c37369b
commit
f0e1f92782
|
@ -109,7 +109,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gmod"
|
name = "gmod"
|
||||||
version = "16.0.1"
|
version = "16.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg_table",
|
"cfg_table",
|
||||||
"cstr",
|
"cstr",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gmod"
|
name = "gmod"
|
||||||
version = "16.0.1"
|
version = "16.0.2"
|
||||||
authors = ["William Venner <william@venner.io>"]
|
authors = ["William Venner <william@venner.io>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -132,10 +132,21 @@ impl LuaState {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
/// You may be looking for `is_none_or_nil`
|
||||||
pub unsafe fn is_nil(&self, index: i32) -> bool {
|
pub unsafe fn is_nil(&self, index: i32) -> bool {
|
||||||
(LUA_SHARED.lua_type)(*self, index) == LUA_TNIL
|
(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)]
|
#[inline(always)]
|
||||||
pub unsafe fn is_function(&self, index: i32) -> bool {
|
pub unsafe fn is_function(&self, index: i32) -> bool {
|
||||||
(LUA_SHARED.lua_type)(*self, index) == LUA_TFUNCTION
|
(LUA_SHARED.lua_type)(*self, index) == LUA_TFUNCTION
|
||||||
|
|
Loading…
Reference in New Issue