lua-users home
lua-l archive

table.sort question

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


Hello,
i am new to lua. My Milestone 312 ACE, a Daisy-Player, Mp3-Player, 
Audiorecorder, from Bones
 http://www.bones.ch
becomes in the next Firmware a lua-interface.
I can test the beta of that fw and so i want to program a little 
adressbook.
Now i have a question to table.sort()
i have a list
local vAdressen = {}
local vAdr = {}
local vAdr.Name = ""
local vAdr.City = ""
...
I read the fields for the vAdr from a csv-file and store them in
vAdressen[1] = vAdr
...
vAdressen[n] = vAdr
so that i have all my adress-datasets in vAdressen
Now i want to sort the table vAdressen for name odr city or ...
If i do
print(vAdressen[1].Name]
the name of my first dataset will be printed
What st the correct syntax for the table.sort() function to sort for name 
or city?
Thanks for your help.
Best regards
Dietmar Segbert

AltStyle によって変換されたページ (->オリジナル) /