This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Termanater13's profile picture

Cannot serialize table with recursive entries error help

Started by Termanater13, 11 April 2014 - 02:50 AM
Termanater13 #1
Posted 11 April 2014 - 04:50 AM
I"m trying to serialize a table that open peripherals returns when I use "tank.getAdvancedMethodsData()", tank is the var I'm using for peripheral.wrap on a thermal expansion tank. I think its giving the error because it is a table that has tables as values. I'm trying to serialize this so I can view it outside of the game to use it as a reference.
theoriginalbit #2
Posted 11 April 2014 - 05:20 AM
yeah I can't exactly remember what table is recursive, but your best option is just to have a search and find a serialize function here on the forums that handles recursive entries (yes they exist).
Termanater13 #3
Posted 11 April 2014 - 06:17 AM
I just looked at that table that "tank.getAdvancedMethodsData()" gives, and it does not reference itself at any point, but there are many points that use the same key and since it already serialized something like it, it thinks there is a recursion on the table and errors. I figured that out by looking at the texutils API code and should be able to write my own code that should work around that
theoriginalbit #4
Posted 11 April 2014 - 06:18 AM
well it doesn't necessarily have to reference itself for that error, a value inside the table could reference itself and the error would arise as well.
Termanater13 #5
Posted 11 April 2014 - 07:19 AM
well it doesn't necessarily have to reference itself for that error, a value inside the table could reference itself and the error would arise as well.
I did a but of editing of the textutils.serialize and made my own with it to see what is really going on, and there is a table referenced twice with one entry that's a ordered list with 1 string as a value. I can make an exception for when this happens. now I know what to expect in the future when this happens again.

But before I call this solved a recursive entry in a table is one that is reference multiple times in the table. This results in multiple instances of the same table in a table that will not always result in a loop, but may cause a loop.