Use `for i, cb in pairs(minetest.registered_on_item_eats do` here.  It's much simpler.