fix setmetatable: allow metatable argument to be optional

pull/15/head
Guilherme Bernal 2 years ago committed by GitHub
parent a26c666001
commit 3153ad1a79
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') 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 return TABLE
} }

Loading…
Cancel
Save