mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Don't use Lua::get_or_init_from_ptr in Require::load wrapper
This commit is contained in:
+5
-5
@@ -422,11 +422,11 @@ pub(super) unsafe extern "C" fn init_config(config: *mut ffi::luarequire_Configu
|
||||
let path = CStr::from_ptr(path).to_string_lossy();
|
||||
let chunk_name = CStr::from_ptr(chunk_name).to_string_lossy();
|
||||
let contents = CStr::from_ptr(contents).to_bytes();
|
||||
let lua = Lua::get_or_init_from_ptr(state);
|
||||
callback_error_ext(state, ptr::null_mut(), false, move |_extra, _| {
|
||||
match this.load(lua, &path, &chunk_name, contents)? {
|
||||
Value::Nil => lua.lock().push(true)?,
|
||||
value => lua.lock().push(value)?,
|
||||
callback_error_ext(state, ptr::null_mut(), false, move |extra, _| {
|
||||
let rawlua = (*extra).raw_lua();
|
||||
match this.load(rawlua.lua(), &path, &chunk_name, contents)? {
|
||||
Value::Nil => rawlua.push(true)?,
|
||||
value => rawlua.push_value(&value)?,
|
||||
};
|
||||
Ok(1)
|
||||
})
|
||||
|
||||
+1
-1
@@ -249,7 +249,7 @@ impl ExtraData {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(super) unsafe fn raw_lua(&self) -> &RawLua {
|
||||
pub(crate) unsafe fn raw_lua(&self) -> &RawLua {
|
||||
&*self.lua.assume_init_ref().raw.data_ptr()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user