Thread Tools Display Modes
04-15-15, 03:37 AM   #1
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Problem: 3-dimensional hash table-entries

Hi!

I'm experiencing an issue while coding my LootCouncil-addon.

The basic situation is: There is a number of members of the loot council (maybe 3 or 4 in the case of my guild) and there is a number of "normal" raid users. Everytime LOOT_OPENED fires, the loot council members get a screen with the available loot and provide the loot to the normal users that therefore vote their "need", "second specc", "transmog", etc.

Technically I've decided to handle this with a three dimensional hash table. Every user creates it's own entry in the hash table like this:

Code:
ORC_Voting[ORC_lootLinks[i]][1][UnitName("player")] = string.join("*", link, ilvl);
While ORC_Voting obviously is the table-name, the first index is the LootLink of the given item, the second index gives concrete information about the voted level (in this case [1] means "pass") and the third index is the user name. After voting the members of the loot council get the command to reload the screen (if the opened tab is the one that shows the item in charge), via SendAddonMessage.

Code:
SendAddonMessage("ORC_USER", "Refresh", "RAID");
This works just fine, I think. The problem is the routine to show the votings to the loot council:

Code:
local function LoadScreen(buttonNumber)
    for n = 1, #ORCA_lootLinks do
        for i = 1, 5 do
            for m = 1, GetNumGroupMembers() do
                local name, _, _, _, _, _, _, _, _, _, _ = GetRaidRosterInfo(m);
                print("Loot Nr. " .. n .. ", Voting Nr. " .. i .. ", Spieler: " .. name .. ": " .. ORC_Voting[ORCA_lootLinks[n]][i][name]);
            end
        end
    end
end
After testing this I got this error. Obviously something is out of index, but I can't find the problem. Can anyone of you?

Or does anyone has any idea for a more simple solution rather than the three-dimensional hash table-thign?

Greetings,

Odjur

Last edited by odjur84 : 04-19-15 at 02:04 AM.
  Reply With Quote
04-15-15, 07:53 AM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Something is outdated as line 53, which the error message indicates, is an empty line in the attached Frame.lua. But I'm assuming this is the offending line:
Code:
print("Loot Nr. " .. n .. ", Voting Nr. " .. i .. ", Spieler: " .. name .. ": " .. ORC_Voting[ORCA_lootLinks[n]][i][name]);
The easiest way to find out where it goes wrong is to build that last table entry in separate steps, and debug while doing so.
Code:
print("ORCA_lootLinks[n]", ORCA_lootLinks[n])
print("ORC_Voting[ORCA_lootLinks[n]]", ORC_Voting[ORCA_lootLinks[n]])
print("ORC_Voting[ORCA_lootLinks[n]][i]", ORC_Voting[ORCA_lootLinks[n]][i])
__________________
Grab your sword and fight the Horde!
  Reply With Quote
04-19-15, 02:03 AM   #3
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Thank you, Lombra!

Since my guild quitted raiding right after I've posted this, this case is closed.

Cheers

Odjur
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Problem: 3-dimensional hash table-entries


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off