Leo32
Getting back into it...
- Joined
- Sep 21, 2007
- Messages
- 990
- Solutions
- 14
- Reaction score
- 551
Hey Guys,
I'm getting a little stuck here;
What I'm after seems simple enough but I'm not familiar enough with tables to get my head around it:
Example output of print line above:
gold coin
bone
mace
viking helmet
pelvis bone
I want to order this in the opposite way.
The end result is:
I want this to execute from the bottom up.
But I can't figure out the logical way or re-ordering the table data to do it.
EDIT: posted this in the wrong forum, derp.
I'm getting a little stuck here;
What I'm after seems simple enough but I'm not familiar enough with tables to get my head around it:
Code:
for _, v in pairs(self:getLoot()) do
local itemList = self:createLootItem(v, modifier)
if itemList then
for _, item in ipairs(itemList) do
print(item:getName()) -- this is the data I would like to re-order.
if item:isContainer() then
local lootContainer = self:createLootContainer(item, v, modifier)
if lootContainer then
corpse:addItemEx(item)
end
else
corpse:addItemEx(item, 1)
end
end
end
end
Example output of print line above:
gold coin
bone
mace
viking helmet
pelvis bone
I want to order this in the opposite way.
The end result is:
I want this to execute from the bottom up.
Code:
corpse:addItemEx(item, 1)
But I can't figure out the logical way or re-ordering the table data to do it.
EDIT: posted this in the wrong forum, derp.
Last edited: