lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

i expected an output order, but it fails ... look

[code]
local tb={['one']=989,['two']='zeze',['tree']=78,['four']='jose
epti',['five']=os.date('!%a, %d-%b-%Y %H:%M:%S GMT')}
table.foreach(tb,function(a,b)  print(a..'-'..b) end)
print(" ")
for k, v in next, tb do print(k..'-'..v) end
print(" ")
for k,v in ipairs(tb) do print(k..'-'..v) end
[/code]
[output]
two-zeze
one-989
tree-78
five-Mon, 05-Apr-2010 20:28:03 GMT
four-jose epti

two-zeze
one-989
tree-78
five-Mon, 05-Apr-2010 20:28:03 GMT
four-jose epti

two-zeze
one-989
tree-78
five-Mon, 05-Apr-2010 20:28:03 GMT
four-jose epti
[/output]

but i expect something like that ...

[output]
one-989
two-zeze
tree-78
four-jose epti
five-Mon, 05-Apr-2010 20:28:03 GMT
[/output]

thanks for help!