Hi Guys, I am tearing my hair out with this one. I tried to post a question like this some time ago and got no joy.
I have several tables that I use as lookup tables. These have city names and x and y coordinates in them. These are working fine. I also have tables that show the relationship between cities - i.e. the amount of stops (turns) between each city etc... I am now writing the AI for my game (a turn based travelling game). My problem is I want to set the table out like:
local AI_London = {
{target = europe.AI_route_London[1].target, first_stop = europe.AI_route_London[1].first_stop, total_stops = europe.AI_route_London[1].total_stops},
}
As well as AI_London, there will be several additional tables (AI_Paris, etc...). I have only put one entry into the table but there will be around 40 for each one.
In my program, I know what the current town is (it could be one of hundreds), and I want to access the relevant table. For instance if the computer player is in Madrid I want to access the AI_Madrid table. I can create a variable such as 'wk_string = "AI_" .. currenttown' and if I print wk_string to the console, it will give me AI_Madrid. My problem is using that to reference the table. Is there some "value" command that I can use. I'm not sure that I've explained myself clearly so please let me know if you need clarification.
Thanks
Adrian