Skip to content

Commit d6fb328

Browse files
committed
Don't use Lua::get_or_init_from_ptr in Require::load wrapper
1 parent edd508e commit d6fb328

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/luau/require.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ pub(super) unsafe extern "C" fn init_config(config: *mut ffi::luarequire_Configu
422422
let path = CStr::from_ptr(path).to_string_lossy();
423423
let chunk_name = CStr::from_ptr(chunk_name).to_string_lossy();
424424
let contents = CStr::from_ptr(contents).to_bytes();
425-
let lua = Lua::get_or_init_from_ptr(state);
426-
callback_error_ext(state, ptr::null_mut(), false, move |_extra, _| {
427-
match this.load(lua, &path, &chunk_name, contents)? {
428-
Value::Nil => lua.lock().push(true)?,
429-
value => lua.lock().push(value)?,
425+
callback_error_ext(state, ptr::null_mut(), false, move |extra, _| {
426+
let rawlua = (*extra).raw_lua();
427+
match this.load(rawlua.lua(), &path, &chunk_name, contents)? {
428+
Value::Nil => rawlua.push(true)?,
429+
value => rawlua.push_value(&value)?,
430430
};
431431
Ok(1)
432432
})

src/state/extra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl ExtraData {
249249
}
250250

251251
#[inline(always)]
252-
pub(super) unsafe fn raw_lua(&self) -> &RawLua {
252+
pub(crate) unsafe fn raw_lua(&self) -> &RawLua {
253253
&*self.lua.assume_init_ref().raw.data_ptr()
254254
}
255255

0 commit comments

Comments
 (0)