Skip to content

setmetatable

setmetatable(table, metatable)

Sets the metatable for the given table. If metatable is nil, the metatable of it is removed. This function returns the table tbl which was passed to it. If tbl already has a metatable with the __metatable metamethod, calling this on table causes an error.