• Register

The near future: Trains are no longer controlled by humans. Instead, artificial intelligence is used to handle traffic. Program the best AI, beat challenges on various maps and watch it fight other AIs in live, online matches!

Forum Thread
  Posts  
rememberPassanger (Games : TrAInsported : Forum : General AI questions : rememberPassanger) Locked
Thread Options
Apr 19 2013 Anchor

Sorry for a stupid question, but I am not familiar with lua.

I store in rememberPassanger all the passengers the have been spawned.
I do it the way it's done in the wiki.
My problem is, that i do not know how to acces the passengers without knowing the names. Does something exist like an iterator?
Another possibility would be to store numerical, but that wouldn't be efficient when deleting a passenger an opponent picked up.
Or other way around, is it possible to acces an table element with different keys? One time per ID, the other time per Passanger name?

Apr 20 2013 Anchor

for name, passenger in pairs(passengerList) do
print(name.." is waiting at ("..passenger.x..", "..passenger.y..")")
end

Apr 22 2013 Anchor

Okay, thx for the answer!

- can be closed!

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.