Tables and variables

numbers = {1,2,3,4,5,6,7,8,9}  
for i = 1, 9, 1 do  
objectselect = tonumber(numbers[i])  
  
item[objectselect].image = "YAY.png";  
end  
  
end  
  

Example code.

How do I use a variable in a table?

table[variable].x = 5; [import]uid: 49300 topic_id: 14035 reply_id: 314035[/import]

It’s just an example code by the way.

enterpassword = {1,2}  
l = tonumber(enterpassword[i-1]);  
b = tonumber(enterpassword[i])  
line = display.newLine(bubble[l].x,bubble[l].y, bubble[b].x,bubble[b].y);  
  

?? IT WON’T WORK!

However

l = 1;  
b = 2  
line = display.newLine(bubble[l].x,bubble[l].y, bubble[b].x,bubble[b].y);  
  

works [import]uid: 49300 topic_id: 14035 reply_id: 51694[/import]