You're almost there but but not quite got it right.
Give this slight change a go
Lua Code:
local function lootReceived(eventCode,receivedBy, itemName, quantity, itemSound, lootType, self)
Loot:SetText("You looted stuff!!!")
d(itemName)
end
local function RegisterLootEvent(eventcode, name)
if (name == "PileOMobs") then
EVENT_MANAGER:RegisterForEvent("PileOMobs",EVENT_LOOT_RECEIVED, lootReceived)
Loot:SetText("Loot event registered.") --- Note: Message probably won't appear at this stage
end
end
function PileOMobsInit(self)
self:RegisterForEvent("PileOMobs", EVENT_ADD_ON_LOADED, RegisterLootEvent)
end