CC: Tweaked

CC: Tweaked

57M Downloads

textutils.serialize recursion check has an edge-case.

fatboychummy opened this issue ยท 3 comments

commented

Minecraft Version

1.16.x

Version

1.98.0

Details

An edge case exists in textutils.serialize currently where if you have two pointers to the same table inside a table, it will cause the recursive entries error -- even though it isn't recursive.

For example,

local x = {x = {}}
x.y = x.x

textutils.serialize(x) -- error!

In the above, it isn't actually recursive, however it causes the "Cannot serialize table with recursive entries" error.

commented

Ah, okay this makes a lot more sense now.

commented

This behavior was definitely noticed in #664 because it adds an allow_repetitions option that is set to nil by default, SquidDev has explained that it probably shouldn't be true by default in #636 (comment) because it will cause the two tables to not be equal to each other in the unserialized version (this issue may also possibly be a duplicate of #636 , which the pull request mentions)

commented

Yep. See #636 for why the current behaviour is what it is.