Help with tables

I have this code. 2 questions.
First how can I get the “unlocked” to give me the value. Right now it spits out nil
Second why is item 2 printing before item1? How can I have it in order?

itemList = {}  
  
itemList.item1 = {}  
itemList.item1.unlocked = true  
  
itemList.item2 = {}  
itemList.item2.unlocked = true  
  
itemList.item3 = {}  
itemList.item3.unlocked = true  
  
for k in pairs(itemList) do   
 print(k)   
 print(k.unlocked)  
end  

Output:

item2
nil
item3
nil
item1
nil

Thanks [import]uid: 8192 topic_id: 13080 reply_id: 313080[/import]

try
[lua]for i,k in pairs(itemList) do
print(k)
print(k.unlocked)
end[/lua] [import]uid: 71210 topic_id: 13080 reply_id: 48047[/import]

Now I get this. Which is good but I need the name of the tables again.

table: 0x6dca60
true
table: 0x6dca80
true
table: 0x6dafb0
true [import]uid: 8192 topic_id: 13080 reply_id: 48056[/import]

try
[lua] print(i) [/lua] [import]uid: 71210 topic_id: 13080 reply_id: 48060[/import]

Awesome. Thank you so much. I have no idea why what u said works but it does.

I guess i don’t understand the" for i,k in pairs (itemList) do " expression. I understand the for loops when the i goes from say 1, 10 etc.

Thanks for your advice and time. [import]uid: 8192 topic_id: 13080 reply_id: 48061[/import]

good to know that it worked…
in the expression “for i,k in pairs (itemList) do” i is the key and k is the value. so the expression reads as “for key,value in pairs(table) do”

Cheers…
Renjith@Technowand
my first app using corona SDK “EmoteMatch” just got approved by apple. please download to support. http://itunes.apple.com/app/id449477288?mt=8 [import]uid: 71210 topic_id: 13080 reply_id: 48063[/import]