Thread Tools Display Modes
11-11-07, 08:52 AM   #1
Durnus
A Murloc Raider
Join Date: Nov 2007
Posts: 5
Displaying table values?!?

Tables/arrays are really confusing... I wish LUA would just use the normal way of doing it.

Well, I've got this:
Code:
for i,v in pairs(ordersN) do 
        if (type(i) == "number") then
            i = tostring(i)
        elseif (type(i) == "boolean") then
            if (i) then
                i = "true"
            else
                i = "false"
            end
        end
        DEFAULT_CHAT_FRAME:AddMessage(i.." : "..v)
    end
And it gets that array fine. But, how would I get the SAME index variable in another array? Lets say I have ordersP, and I want it to display:

0 : PlayerName : ValueP

How would I do this?

(Plus, is there any way to use arrays as they should be used? As in, being able to simply find their length and use ordersP[50] to access the 50th space?)

Thanks!
  Reply With Quote
11-11-07, 01:32 PM   #2
Eidolarr
An Aku'mai Servant
 
Eidolarr's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 34
DevTools will let you print the contents of a table.

Not sure about what you're asking with the rest of your post - you can certainly use tables as arrays and use numbers as indices...

I haven't looked at the code of DevTools, but I assume it calls itself recursively on any nested tables, while keeping a list of tables already visited (lest self referential tables cause an endless loop).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Displaying table values?!?

Thread Tools
Display Modes

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