Add lua_xpush to 5.1-5.4
This commit is contained in:
parent
0919ff21c9
commit
f7ee6dc635
|
@ -324,6 +324,12 @@ pub unsafe fn lua_tostring(L: *mut lua_State, i: c_int) -> *const c_char {
|
||||||
lua_tolstring(L, i, ptr::null_mut())
|
lua_tolstring(L, i, ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub unsafe fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: c_int) {
|
||||||
|
lua_pushvalue(from, idx);
|
||||||
|
lua_xmove(from, to, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debug API
|
// Debug API
|
||||||
//
|
//
|
||||||
|
|
|
@ -410,6 +410,12 @@ pub unsafe fn lua_tostring(L: *mut lua_State, i: c_int) -> *const c_char {
|
||||||
lua_tolstring(L, i, ptr::null_mut())
|
lua_tolstring(L, i, ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub unsafe fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: c_int) {
|
||||||
|
lua_pushvalue(from, idx);
|
||||||
|
lua_xmove(from, to, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debug API
|
// Debug API
|
||||||
//
|
//
|
||||||
|
|
|
@ -434,6 +434,12 @@ pub unsafe fn lua_replace(L: *mut lua_State, idx: c_int) {
|
||||||
lua_pop(L, 1)
|
lua_pop(L, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub unsafe fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: c_int) {
|
||||||
|
lua_pushvalue(from, idx);
|
||||||
|
lua_xmove(from, to, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Debug API
|
// Debug API
|
||||||
//
|
//
|
||||||
|
|
|
@ -455,6 +455,12 @@ pub unsafe fn lua_replace(L: *mut lua_State, idx: c_int) {
|
||||||
lua_pop(L, 1)
|
lua_pop(L, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
pub unsafe fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: c_int) {
|
||||||
|
lua_pushvalue(from, idx);
|
||||||
|
lua_xmove(from, to, 1);
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn lua_newuserdata(L: *mut lua_State, sz: usize) -> *mut c_void {
|
pub unsafe fn lua_newuserdata(L: *mut lua_State, sz: usize) -> *mut c_void {
|
||||||
lua_newuserdatauv(L, sz, 1)
|
lua_newuserdatauv(L, sz, 1)
|
||||||
|
|
|
@ -2394,12 +2394,6 @@ impl Lua {
|
||||||
"Lua instance passed Value created from a different main Lua state"
|
"Lua instance passed Value created from a different main Lua state"
|
||||||
);
|
);
|
||||||
let extra = &*self.extra.get();
|
let extra = &*self.extra.get();
|
||||||
#[cfg(not(feature = "luau"))]
|
|
||||||
{
|
|
||||||
ffi::lua_pushvalue(extra.ref_thread, lref.index);
|
|
||||||
ffi::lua_xmove(extra.ref_thread, self.state, 1);
|
|
||||||
}
|
|
||||||
#[cfg(feature = "luau")]
|
|
||||||
ffi::lua_xpush(extra.ref_thread, self.state, lref.index);
|
ffi::lua_xpush(extra.ref_thread, self.state, lref.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue