Bind lua_equal

This commit is contained in:
William Venner 2022-01-28 16:08:52 +00:00
parent f8554b3402
commit 87d25a2205
4 changed files with 9 additions and 2 deletions

2
Cargo.lock generated
View File

@ -109,7 +109,7 @@ dependencies = [
[[package]] [[package]]
name = "gmod" name = "gmod"
version = "14.0.1" version = "14.0.2"
dependencies = [ dependencies = [
"cfg_table", "cfg_table",
"cstr", "cstr",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "gmod" name = "gmod"
version = "14.0.1" version = "14.0.2"
authors = ["William Venner <william@venner.io>"] authors = ["William Venner <william@venner.io>"]
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"

View File

@ -173,6 +173,7 @@ pub struct LuaShared {
pub lua_tothread: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index: i32) -> LuaState>, pub lua_tothread: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index: i32) -> LuaState>,
pub lua_status: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState) -> i32>, pub lua_status: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState) -> i32>,
pub lua_xmove: Symbol<'static, unsafe extern "C-unwind" fn(thread1: LuaState, thread2: LuaState, n: i32)>, pub lua_xmove: Symbol<'static, unsafe extern "C-unwind" fn(thread1: LuaState, thread2: LuaState, n: i32)>,
pub lua_equal: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index1: i32, index2: i32) -> i32>,
} }
unsafe impl Sync for LuaShared {} unsafe impl Sync for LuaShared {}
impl LuaShared { impl LuaShared {
@ -247,6 +248,7 @@ impl LuaShared {
lua_tothread: find_symbol!("lua_tothread"), lua_tothread: find_symbol!("lua_tothread"),
lua_status: find_symbol!("lua_status"), lua_status: find_symbol!("lua_status"),
lua_xmove: find_symbol!("lua_xmove"), lua_xmove: find_symbol!("lua_xmove"),
lua_equal: find_symbol!("lua_equal"),
} }
} }
} }

View File

@ -511,6 +511,11 @@ impl LuaState {
(LUA_SHARED.lua_xmove)(*self, target_thread, n) (LUA_SHARED.lua_xmove)(*self, target_thread, n)
} }
#[inline(always)]
pub unsafe fn equal(&self, index1: i32, index2: i32) -> bool {
(LUA_SHARED.lua_equal)(*self, index1, index2) == 1
}
#[inline(always)] #[inline(always)]
/// See `call` /// See `call`
pub unsafe fn coroutine_resume_call(&self, narg: i32) { pub unsafe fn coroutine_resume_call(&self, narg: i32) {