debug.setmetatable (object, table)

Sets the metatable for the given object to the given table (which can be nil).