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

This subforum contains all the issues which we already resolved.
Ket
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon May 18, 2020 7:26 am
Contact:

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

Post 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.
Attachments
factorio-current.log
(17.11 KiB) Downloaded 136 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14339
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”