Lua: Reject setting metatable to a nil value
parent
e44b2776df
commit
4f707e498c
|
@ -124,7 +124,10 @@ const xpcallFunction = new LuaBuiltinFunction(
|
||||||
);
|
);
|
||||||
|
|
||||||
const setmetatableFunction = new LuaBuiltinFunction(
|
const setmetatableFunction = new LuaBuiltinFunction(
|
||||||
(_sf, table: LuaTable, metatable: LuaTable) => {
|
(sf, table: LuaTable, metatable: LuaTable) => {
|
||||||
|
if (!metatable) {
|
||||||
|
throw new LuaRuntimeError("metatable cannot be set to nil", sf);
|
||||||
|
}
|
||||||
table.metatable = metatable;
|
table.metatable = metatable;
|
||||||
return table;
|
return table;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue