-
-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An option to disable references on tables in toJSON() #1074
Comments
That's one of MTA's weird behaviours and was made to prevent recursive table constructs. Not sure what we do about that. Just changing it would break breakwards compatibility, so we would at least need a parameter to control that. But I generally agree with you that the behaviour you described is the expected behaviour. |
I'm pretty sure it's just to reduce the size (there is similar things on element data, afair). And I'm not
fromJSON still will work and result will be same for both cases (old and new). The result of improved toJSON also will be valid. So, how it would break something? Can you give an example?
Sure. But any lua's implementation reduces performance. And it may be critical in some cases. |
If you have a table that refers to itself in the table, this causes an issue. This JSON behavior was introduced to prevent infinite referencing although in JS such is prevented by actual error. Problem is it doesn't seem to work right.
It will break backwards compatibility in toJSON as per your issue description. Some people may be relying on the old format. Also isn't this a duplicate of #1073? |
No. 1073 is about {} |
Ah, you're right. Seems like we had discussion about this issue in there so I got confused. |
Could someone change type from |
Describe the bug
If there are links to same table then
toJSON()
will insert the table only ocne and all other times a link will be used (^T^
):It may be OK for some cases, but if we want to use it outside of MTA, it's not useful at all. Most cases we want the result would be like this:
To reproduce
Expected behaviour
Screenshots
none
Version
1.5.6
Additional context
I'm not sure this is a bug. If it will be an option (toJSON's arument), it is also OK.
A little discussion about the issue there
The text was updated successfully, but these errors were encountered: