Collision events and metatables

Normally you can’t destroy a physic body inside his own collision event.

But it seems that you can, if the collision function runs over a metatable.

local bullet\_class = {} bullet\_class.metatable = {\_\_index = bullet\_class}   function bullet\_class:new()    local bullet = {}    setmetatable(bullet, bullet\_class.metatable)      local graphic\_obj = display.newRect(0,0,10,10)    bullet.graphic\_obj = graphic\_obj       physics.addBody( graphic\_obj, "dynamic", { density = 0.1, friction = 0, bounce = 0, radius=5, isSensor=true})      graphic\_obj:addEventListener("collision", bullet)      return bullet end   function bullet\_class:collision(event)    display.removeBody(self.graphic\_obj) end

Now I’m curious why that is and if it is safe to rely on it?

Greetings Torben