I'm creating a turn-based game in Gideros (which uses Lua) and I'm running into a problem of recording the events of each actor. I want the player to be able to set a path, direction, and fire event for every actor they control. I had an idea of using multidimensional arrays like
TaskList = { 1 = { "MoveTo", {3,5} },
2 = { "AimTo", {5,2} },
3 = { "Fire" },
4 = { "MoveTo", {23,21} }
however that seemed like an awfully annoying and inefficient way to do it. Is there any obviously better way? Thanks.
I would suggest the following:
1 =
, 2 =
, etc. This is implied with "array" initialization syntax.For example:
TaskList = {
{ action="MoveTo", location={3,5} },
{ action="AimTo", location={5,2} },
{ action="Fire" },
{ action="MoveTo", location={23,21} }
}