diff --git a/common/space_lua/stdlib.ts b/common/space_lua/stdlib.ts index ca3d0ee3..a993f7fd 100644 --- a/common/space_lua/stdlib.ts +++ b/common/space_lua/stdlib.ts @@ -124,7 +124,10 @@ const xpcallFunction = 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; return table; },