Skip to content

Refactor stringify, add tests for it, and use it in some exports#2347

Open
vaisest wants to merge 5 commits into
PathOfBuildingCommunity:devfrom
vaisest:export-refactor
Open

Refactor stringify, add tests for it, and use it in some exports#2347
vaisest wants to merge 5 commits into
PathOfBuildingCommunity:devfrom
vaisest:export-refactor

Conversation

@vaisest

@vaisest vaisest commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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) . See flavourText.lua for 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:

  • Old tests pass
  • New tests were added

Link to a build that showcases this PR:

Before screenshot:

After screenshot:

image

@vaisest vaisest force-pushed the export-refactor branch from 262f00e to 3cde972 Compare July 4, 2026 11:34
@vaisest

vaisest commented Jul 4, 2026

Copy link
Copy Markdown
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 writeLuaTable() here even though it fills a similar function. It seemed to have some custom export logic so I left it alone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant