function World:destroyEntity(entity) for i, e in ipairs(self.entities) do if e == entity then table.remove(self.entities, i) break end end entity:onDestroy() end