fix setmetatable: allow metatable argument to be optional

pull/21/head
Guilherme Bernal 2 years ago committed by Teodor Tanasoaia
parent a26c666001
commit f1401ec12b

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

Loading…
Cancel
Save