Refactor stringify, add tests for it, and use it in some exports#2347
Open
vaisest wants to merge 5 commits into
Open
Refactor stringify, add tests for it, and use it in some exports#2347vaisest wants to merge 5 commits into
vaisest wants to merge 5 commits into
Conversation
Contributor
Author
|
3cde972 converted mods.lua to use this. This was mostly done to test performance (it's now only a bit slower, probably because the string is saved in memory instead of being written directly). If it's not ok, feel free to revert the commit. It does change the style of the written file as originally each mod was on it's own line. I think this might be an improvement since the statOrder seems to often change and it makes finding new/removed mods from github diffs pretty hard. I've not replaced |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the problem being solved:
Doesn't solve anything, but I think this makes it easier to export files, which this program does a lot of of. I think the style of manually writing output files character by character is pretty difficult to work with, and something like this means you can just build a table and do
utils.saveTableToFile(path, table, description). SeeflavourText.luafor an example.This also rewrites
stringify()and makes it work with a lot more tables. For example multi-line string keys, table keys, mixed tables work now. Some of the table types that Lua supports like function keys were skipped.Steps taken to verify a working solution:
Link to a build that showcases this PR:
Before screenshot:
After screenshot: