Page 1 of 1

[Rseding91] [0.17.79] Unable to iterate over a full table of forces.

Posted: Mon May 18, 2020 8:09 am
by Ket
The game crashes when attempting to iterate over the "game.forces" table if the maximum of 63 forces has been reached. I ran into this bug when using the API to add all forces in a game to a list-box element.

To reproduce this in a fresh 'Freeplay' scenario (via the console) create the max. number of forces then iterate over them.

Code: Select all

/c for i=0,60 do game.create_force(i) end
/c for k, v in pairs(game.forces) do game.players[1].print(v.name) end
I also wondered if it was just the name value that was causing an issue, but it also crashes the game if you run the following...

Code: Select all

/c for k, v in pairs(game.forces) do v.reset() end
You are able to iterate over the table as long as you haven't reached the maximum number of forces; tested by only creating 59 forces and less.

Re: [Rseding91] [0.17.79] Unable to iterate over a full table of forces.

Posted: Mon May 18, 2020 8:03 pm
by Rseding91
Thanks for the report. It's now fixed for the next release.

Additionally, the "maximum forces is 63" thing was just wrong. It's actually 64: with 3 base forces that leaves 61 forces mods can create.