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

pull/11/head
Guilherme Bernal 2 years ago committed by GitHub
parent 2f1cf03d42
commit ceb5a5cfe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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