Error while running deserialisation

Place to get help with not working mods / modding interface.
trold
Inserter
Inserter
Posts: 45
Joined: Fri Jul 31, 2015 1:07 pm
Contact:

Error while running deserialisation

Post by trold »

I am writing a mod (Bottleneck), which puts indicator lights on assembling machines and furnaces. The mod keeps track of these with a table "overlays" that maps machine to its indicator light. So far so good. The problem comes, if I place this table in global (i.e., replace "overlays" with "global.overlays"). Then I get this error on load time:
Error while running deserialisation: [string "do local _={overlays={},freeze={}};local tabl..."]:1: too many local variables (limit is 200) in main function near '='
I only get this error, when I have more than 200 a bunch of assembling machines in the table. What is the correct way to do this?
User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 254
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: Error while running deserialisation

Post by DedlySpyder »

Can you provide the actual code that causing the problem? The error cuts it off.
trold
Inserter
Inserter
Posts: 45
Joined: Fri Jul 31, 2015 1:07 pm
Contact:

Re: Error while running deserialisation

Post by trold »

DedlySpyder wrote:Can you provide the actual code that causing the problem? The error cuts it off.
The error occurs in the deserialisation, and thus not directly in code that I have written. The code for the mod can be found here: https://raw.githubusercontent.com/troel ... ontrol.lua.
trold
Inserter
Inserter
Posts: 45
Joined: Fri Jul 31, 2015 1:07 pm
Contact:

Re: Error while running deserialisation

Post by trold »

Zinal posted a fix. It appears that serialisation doesn't work properly, if the table contains entities as indices or values.

https://github.com/troelsbjerre/Bottleneck/issues/1
Rseding91
Factorio Staff
Factorio Staff
Posts: 15967
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error while running deserialisation

Post by Rseding91 »

trold wrote:Zinal posted a fix. It appears that serialisation doesn't work properly, if the table contains entities as indices or values.

https://github.com/troelsbjerre/Bottleneck/issues/1
Yes it does, you're just hitting a built in limit of Lua. See my reply on the github conversation.
If you want to get ahold of me I'm almost always on Discord.
trold
Inserter
Inserter
Posts: 45
Joined: Fri Jul 31, 2015 1:07 pm
Contact:

Re: Error while running deserialisation

Post by trold »

Rseding91 wrote:Yes it does, you're just hitting a built in limit of Lua. See my reply on the github conversation.
Could I get you to check out the "naiveglobal" branch of troelsbjerre/Bottleneck, and have a look at why that give an error after saving and loading? As far as I can see, I only have two values directly in the global table.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15967
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error while running deserialisation

Post by Rseding91 »

trold wrote:
Rseding91 wrote:Yes it does, you're just hitting a built in limit of Lua. See my reply on the github conversation.
Could I get you to check out the "naiveglobal" branch of troelsbjerre/Bottleneck, and have a look at why that give an error after saving and loading? As far as I can see, I only have two values directly in the global table.
Can you upload a save file that has this issue in it?
If you want to get ahold of me I'm almost always on Discord.
trold
Inserter
Inserter
Posts: 45
Joined: Fri Jul 31, 2015 1:07 pm
Contact:

Re: Error while running deserialisation

Post by trold »

Can you upload a save file that has this issue in it?
Sent in a PM.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: Error while running deserialisation

Post by binbinhfr »

So what was the conclusion of that thread ? Any solution to avoid the serialisation problem on long lists ?
Is avoiding table indexed with entities is the final solution ?
No limitations on tables indexed by numbers of strings ?
My mods on the Factorio Mod Portal :geek:
Rseding91
Factorio Staff
Factorio Staff
Posts: 15967
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Error while running deserialisation

Post by Rseding91 »

binbinhfr wrote:So what was the conclusion of that thread ? Any solution to avoid the serialisation problem on long lists ?
Is avoiding table indexed with entities is the final solution ?
No limitations on tables indexed by numbers of strings ?
It's a limitation of the lua library - not something we can change.
If you want to get ahold of me I'm almost always on Discord.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: Error while running deserialisation

Post by binbinhfr »

Rseding91 wrote:It's a limitation of the lua library - not something we can change.
Ok, thx Rseding, I just wanted a clarification on what should be avoided.
If you have in minds other coding situations that could lead to such errors, please share ;-)
My mods on the Factorio Mod Portal :geek:
Post Reply

Return to “Modding help”