In the simplest terms, my problem is thus:
--the array:
FontStrings = { fontstring1, fontstring2 }
--the problem I'm having:
xyz = fontstring1
xyz:SetText("hello") --this method works (prints fontstring1)
xyz = FontStrings[1]
xyz:SetText("hello") --this method doesn't, and I need it to.
Any help is appreciated.
--Bart
QuoteOriginally posted by Barticus
In the simplest terms, my problem is thus:
--the array:
FontStrings = { fontstring1, fontstring2 }
--the problem I'm having:
xyz = fontstring1
xyz:SetText("hello") --this method works (prints fontstring1)
xyz = FontStrings[1]
xyz:SetText("hello") --this method doesn't, and I need it to.
Any help is appreciated.
--Bart
xyz = FontStrings[1]
xyz:SetText("hello") --this method doesn't, and I need it to.
this not work because caps not is good.. :). c ya
hmm, I may be confused.
Do you mean I shouldn't have the table name be capitalized?
There is no mismatch in cases in the example I gave.
Here, I'll break it down even further:
z { y }
x=y --works
x = z[1] --doesn't
--where...
x:SetText("hi")
--is concerned.
I'd like to know why that is, and how to set x to = y via the array element
thanks again.
This works for me: x="hey"
y="hi"
arr={x,y}
print(arr[1],arr[2])
QuoteOriginally posted by bastya_elvtars
This works for me: x="hey"
y="hi"
arr={x,y}
print(arr[1],arr[2])
Yeah, but you'll notice that the value in my array is not a string -- in fact, I guess it registers as a key, since it's not an integer or a string. I'm trying to call it as a variable. I guess I can't do that?
I'm trying to put oft-repeated variables in a table to shorten things up (get rid of some clutter), and place loops in certain functions calling the elements of the array as the variables in the loop.
as in:
frames { frame1, frame2, frame3}
for i=1, 3 do
frame
:Show()
end
so 3 different unique frames listed in the array called targframe pop up.
I've messed around a bit with making the table a dictionary and toying with..
for key, value in frames do
..I seem to run into the same brick wall. I think I need some way of identifying the elements as valueless variables within the table.
I hope this clears it up again, and thanks again for the help.
frames.frame1
This way you call it.
And notice my array declaration.
QuoteOriginally posted by bastya_elvtars
frames.frame1
This way you call it.
And notice my array declaration.
Well, that would be a dictionary, which would be fine by me. But even so, how do I put it in a loop so I don't have to have this:
frames.frame1
frames.frame2
frames.frame3
etc, etc over and over in my script?
I have one function with 6 elseif statements just filled with things I'd much rather loop through using a counter.
like:
frames.frame
for index, key in ipairs(array) do
for index, key in pairs(table) do
plop
Barticus, you might want to check this page (http://ptxwiki.psycho-chihuahua.net/doku.php/scriptinghelp/tables) out.
QuoteOriginally posted by bastya_elvtars
Barticus, you might want to check this page (http://ptxwiki.psycho-chihuahua.net/doku.php/scriptinghelp/tables) out.
4got to tell him abt that!