Error while running deserialisation

Place to get help with not working mods / modding interface.
Ferovejecs
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Aug 13, 2016 6:43 am
Contact:

Error while running deserialisation

Post by Ferovejecs »

Wondering if this limit is intended, and whether there is a way around it?

Error while running deserialisation: [string "...":1: too many local variables (limit is 200) in main function near '='

Basically it seems that for lua code for a scenario, if there are more than 200 items in a hashmap, it crashes.

Script attached, also attached a save game which triggers this error upon loading it. I'll ask my friend to put up a desync log/report from attempting to join a game after this state (e.g. there having been more than 200 chests stored in the global hashmap).
Attachments
control.lua
(36.32 KiB) Downloaded 135 times
_autosave1-backup.zip
(31.42 MiB) Downloaded 97 times
Danner
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Sep 14, 2016 12:28 pm
Contact:

Re: Error while running deserialisation

Post by Danner »

Previously announced friend here.

Factorio deleted the original desync report zip file once I restarted the game, but I did have an uncompressed version of it lying around.
Here it is, recompressed. Warning: 100 mb download.

http://www.pvv.org/~andreasd/desync_report.zip
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error while running deserialisation

Post by Rseding91 »

It's a limit of the Lua language. You're using tables as keys which is what triggers it.

If you avoid that it works well beyond that limit.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Error while running deserialisation

Post by eradicator »

Use unit_number instead of the position for your chests. The unit number is a unique identifier which is supposed to be used for indexing tables of entities.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Ferovejecs
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Aug 13, 2016 6:43 am
Contact:

Re: Error while running deserialisation

Post by Ferovejecs »

Awesome, thanks for the help guys!
Post Reply

Return to “Modding help”