Skip to content

Commit e10623d

Browse files
committed
Update __mlua_index/__mlua_newindex chunk names
1 parent c3ab89b commit e10623d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/userdata/util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ unsafe fn init_userdata_metatable_index(state: *mut ffi::lua_State) -> Result<()
354354
end
355355
"#;
356356
protect_lua!(state, 0, 1, |state| {
357-
let ret = ffi::luaL_loadbuffer(state, code.as_ptr(), code.count_bytes(), cstr!("__mlua_index"));
357+
let ret = ffi::luaL_loadbuffer(state, code.as_ptr(), code.count_bytes(), cstr!("=__mlua_index"));
358358
if ret != ffi::LUA_OK {
359359
ffi::lua_error(state);
360360
}
@@ -405,7 +405,8 @@ unsafe fn init_userdata_metatable_newindex(state: *mut ffi::lua_State) -> Result
405405
end
406406
"#;
407407
protect_lua!(state, 0, 1, |state| {
408-
let ret = ffi::luaL_loadbuffer(state, code.as_ptr(), code.count_bytes(), cstr!("__mlua_newindex"));
408+
let code_len = code.count_bytes();
409+
let ret = ffi::luaL_loadbuffer(state, code.as_ptr(), code_len, cstr!("=__mlua_newindex"));
409410
if ret != ffi::LUA_OK {
410411
ffi::lua_error(state);
411412
}

0 commit comments

Comments
 (0)