Nice, farangkao.
Better yet, put the check right at the beginning so you exit as quickly as possible:
Lua Code:
function MB.SingleSlotUpdate(eventCode,bagId, slotId, isNewItem, itemSoundCategory, updateReason)
if not isNewItem then
return
end
-- Actual code here
end
Though as circonian noted, it does remove details in the dataEntry table. So if you use that or cache the slotIndex values, you're going to need to update the slots instead of this (and should probably do it as a delayed full scan).