mirror of
https://github.com/mlua-rs/mlua
synced 2026-06-08 16:05:43 +00:00
Fix Table::raw_push for luau when readonly
This commit is contained in:
+7
-1
@@ -322,7 +322,13 @@ impl<'lua> Table<'lua> {
|
||||
let len = ffi::lua_rawlen(state, -2) as Integer;
|
||||
ffi::lua_rawseti(state, -2, len + 1);
|
||||
}
|
||||
if lua.unlikely_memory_error() {
|
||||
|
||||
#[cfg(not(feature = "luau"))]
|
||||
let protect = !lua.unlikely_memory_error();
|
||||
// If Luau table is readonly it will throw an exception
|
||||
#[cfg(feature = "luau")]
|
||||
let protect = !lua.unlikely_memory_error() || self.is_readonly();
|
||||
if !protect {
|
||||
callback(lua.state);
|
||||
} else {
|
||||
protect_lua!(lua.state, 2, 0, fn(state) callback(state))?;
|
||||
|
||||
Reference in New Issue
Block a user