For Loop Issue
Ok so I made up my button template, and I can call it and set each field with no problem, but I'm having issues setting the fields through a for loop.
Code:
GRFrame.rosterSlot..i.level:SetText("35"); GRFrame is my base frame, it has the following line of code after making my roster button: Code:
frame.rosterSlot1 = rosterSlot1; and my template uses level as the parentkey for a fontstring, and i is my index from my for loop. I know that the following code works: Code:
GRFrame.rosterSlot1.level:SetText(03) V |
Quote:
http://www.lua.org/manual/5.1/manual.html#2.1 Quote:
http://www.lua.org/manual/5.1/manual.html#2.5.7 Code:
t.x = 1 -- t["x"] = 1 |
Quote:
Code:
table[1] = rosterSlot1; V |
Quote:
Code:
for i = 1, 10 do Code:
for name, object in pairs(GRFrame) do |
Quote:
ie Code:
GRFrame.rosterButton = createframe("button", "rosterButton", GRFrame, "UIbuttonTemplate"); the idea was to keep it all clean similar to several posts I've seen of yours I liked how clean it was and easy to read, but I added a table of all the "rosterbuttons" and it seems to be functioning as intended as the table just references the button objects allowing me to call functions etc from it. I tried the code you included but wasn't able to make it work right for some reason, and I don't have the code from that section anymore since the rewrite... Still love the tips and will try it next time I run across this issue. Ty lots! |
Quote:
|
Quote:
Lua Code:
At this point, aFrame and aTable are both tables with exactly the same methods; you can add members to both, and you can call :SetPoint, :CreateTexture, or another frame function on either one. However, since aTable is just a table, and not a frame, it doesn't have the userdata, and the method calls will return errors because they're trying to manipulate a frame object in C code that doesn't exist. Aside from frame-specific methods that operate on the userdata attached to a frame, though, frames in WoW are really just nothing but tables. Quote:
|
All times are GMT -6. The time now is 05:22 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI