Sorry about that lococo, I’m still finding my way around forums as well!!
I changed that to the 2 as specified, several hours later i’m getting closer but still not right, here is what I have so far.
Table being created and populated
t = {}
t[1] = false
t[2] = false
t[3] = true
Code to show the star if = true
for i = 1, #t do
if t[i] == true then
local star1 = display.newImage( "images/gameplay/star.png", 100, 300)
localGroup:insert(star1)
end
end
for i = 2, #t do
if t[i] == true then
local star2 = display.newImage( "images/gameplay/star.png", 250, 300)
localGroup:insert(star2)
end
end
for i = 3, #t do
if t[i] == true then
local star3 = display.newImage( "images/gameplay/star.png", 450, 300)
localGroup:insert(star3)
end
end
Terminal is showing this when i print it:
1 false
2 false
3 true
But all i’m getting is all stars showing which is wrong, it should only show star 3?
I’ve tried lots of different ways, i.e. instead of true using 1, 2, 3 but with the same results.
If i change it to be all false none show up, or if i change it to the second star being true the first and second star show up?
It’s very odd and very annoying, I’m clearly missing something and have been reading lots on tables all night with no luck, any advice would be greatly appreciated.
Thanks all. [import]uid: 13654 topic_id: 5352 reply_id: 18125[/import]