-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[no squash] Revamp dump
#16083
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
Merged
Merged
[no squash] Revamp dump
#16083
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
165f8c0
dump[2]: avoid misleading rounding of numbers
appgurueu a662caa
Revamp `dump`
appgurueu 0d11d24
Implement helpful `__tostring` for all userdata-based classes
appgurueu c95c8be
Optimize appending to tables in `core.serialize` and `dump`
appgurueu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this undocumented "feature". I think if modders want this, they should do
dump(getmetatable(value))explicitly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was an explicitly requested feature: #6842
re "undocumented": documenting the precise behavior of a pure debugging helper function isn't needed and can only cause us problems in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder whether @HybridDog would still consider this feature a good idea today?
sure. i'm just trying to argue that i should be somewhat free to remove things like this if i can make a half-decent case that they should be removed.
ultimately i don't mind putting it back in terribly much but i still think it shouldn't work like that.
dump({player}, "")gives you{<userdata>,}butdump(player, "")dumps you the (usually annoyingly big) metatable? that's just confusing if you ask me, it breaks the natural recursive nature ofdumpand adds a weird special case.we should probably give our userdata proper
__tostringimplementations which identify it. e.g.PlayerRef: singleplayeror something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah if it doesn't work recursively I agree it's not ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if a modder uses dump() on a variable to find out what it is, an output like
userdata: 0x7acd0162a3e0is not very helpful to him/her and showing the metatable is also not ideal. Removing the feature to print the metatable is fine for me.Adding
__tostringimplementations for userdata sounds like a better solution if this is possible.