Add `lua_topointer`
This commit is contained in:
parent
eea1e4b15d
commit
d1413ea013
|
@ -124,6 +124,7 @@ pub(crate) struct LuaShared {
|
||||||
pub lua_getinfo: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, what: LuaString, ar: *mut LuaDebug) -> i32>,
|
pub lua_getinfo: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, what: LuaString, ar: *mut LuaDebug) -> i32>,
|
||||||
pub lua_getstack: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, level: i32, ar: *mut LuaDebug) -> i32>,
|
pub lua_getstack: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, level: i32, ar: *mut LuaDebug) -> i32>,
|
||||||
pub lua_next: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index: i32) -> i32>,
|
pub lua_next: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index: i32) -> i32>,
|
||||||
|
pub lua_topointer: Symbol<'static, unsafe extern "C-unwind" fn(state: LuaState, index: i32) -> *const c_void>,
|
||||||
}
|
}
|
||||||
unsafe impl Sync for LuaShared {}
|
unsafe impl Sync for LuaShared {}
|
||||||
impl LuaShared {
|
impl LuaShared {
|
||||||
|
@ -188,6 +189,7 @@ impl LuaShared {
|
||||||
lua_getinfo: find_symbol!("lua_getinfo"),
|
lua_getinfo: find_symbol!("lua_getinfo"),
|
||||||
lua_getstack: find_symbol!("lua_getstack"),
|
lua_getstack: find_symbol!("lua_getstack"),
|
||||||
lua_next: find_symbol!("lua_next"),
|
lua_next: find_symbol!("lua_next"),
|
||||||
|
lua_topointer: find_symbol!("lua_topointer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,11 @@ impl LuaState {
|
||||||
(LUA_SHARED.lua_next)(*self, index)
|
(LUA_SHARED.lua_next)(*self, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub unsafe fn to_pointer(&self, index: i32) -> *const c_void {
|
||||||
|
(LUA_SHARED.lua_topointer)(*self, index)
|
||||||
|
}
|
||||||
|
|
||||||
pub unsafe fn error<S: AsRef<str>>(&self, msg: S) -> ! {
|
pub unsafe fn error<S: AsRef<str>>(&self, msg: S) -> ! {
|
||||||
self.push_string(msg.as_ref());
|
self.push_string(msg.as_ref());
|
||||||
(LUA_SHARED.lua_error)(*self);
|
(LUA_SHARED.lua_error)(*self);
|
||||||
|
|
Loading…
Reference in New Issue