fix: setmetatable should remove the metatable if the argument is null

pull/15/head
Guilherme Bernal 2 years ago committed by Teodor Tanasoaia
parent b9af44bfde
commit 9c0ac8baa1

@ -256,7 +256,7 @@ function setmetatable(table: LuaType, metatable: LuaType): Table {
throw new LuaError('cannot change a protected metatable')
}
TABLE.metatable = coerceArgToTable(metatable, 'setmetatable', 2)
TABLE.metatable = metatable === null ? null : coerceArgToTable(metatable, 'setmetatable', 2)
return TABLE
}

Loading…
Cancel
Save