I’m trying to build a lookup table in lua so that when a user selects a particular person, I can return that person’s info. Problem is, I can’t seem to figure out how to access a particular person in the table…
[lua] – The following would normally come from a user’s choice.
local selectedDealer = “Gerald”
dealers = {
dealerName = “Gerald”,
mainPhone = “(512) 555-1212”,
salesPhone = “(512) 555-1212”,
servicePhone = “(512) 555-1212”,
}
dealers = {
dealerName = “Tom”,
mainPhone = “(512) 555-1212”,
salesPhone = “(512) 555-1212”,
servicePhone = “(512) 555-1212”,
}
– The following returns ‘nil’
if table.indexOf( dealers[dealerName], selectedDealer) then
print (“Gerald Found!”)
elseif table.indexOf( dealers[dealerName], selectedDealer) then
print (“Tom Found!”)
else
print (“None found!”)
end[/lua]
Any help would be greatly appreciated!! [import]uid: 64538 topic_id: 33637 reply_id: 333637[/import]