Page 1 of 1

Error while running deserialisation

Posted: Fri Jul 15, 2016 7:23 am
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?

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 2:31 pm
by DedlySpyder
Can you provide the actual code that causing the problem? The error cuts it off.

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 2:41 pm
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.

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 4:15 pm
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

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 8:51 pm
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.

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 9:29 pm
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.

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 9:43 pm
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?

Re: Error while running deserialisation

Posted: Fri Jul 15, 2016 9:53 pm
by trold
Can you upload a save file that has this issue in it?
Sent in a PM.

Re: Error while running deserialisation

Posted: Mon Jul 25, 2016 12:30 pm
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 ?

Re: Error while running deserialisation

Posted: Mon Jul 25, 2016 1:56 pm
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.

Re: Error while running deserialisation

Posted: Mon Jul 25, 2016 2:10 pm
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 ;-)