You are viewing a potentially older version of this package.
View all versions.
TomlHelper
Helper mod for saving and loading Toml config files for SmoothSpatula mods.
| Date uploaded | a year ago |
| Version | 1.1.0 |
| Download link | SmoothSpatula-TomlHelper-1.1.0.zip |
| Downloads | 171 |
| Dependency string | SmoothSpatula-TomlHelper-1.1.0 |
This mod requires the following mods to function
MGReturns-ENVY
A plugin to allow ReturnOfModding plugins greater control of their environment.
Preferred version: 1.1.1README
SmoothSpatula-TomlHelper
Helper mod for saving and loading Toml config files for SmoothSpatula mods.
Usage
- Initializing and loading the config
mods["SmoothSpatula-TomlHelper"].auto()
params = {
max_number = 4,
enabled = true
}
params = Toml.config_update(_ENV["!guid"], params, {drop_empty_tables = true}) -- Load and Save (merge)
-- or
params = Toml.config_update(_ENV["!guid"], params) -- this will create plugin_name/cfg.toml
-- or if you want to make multiple configs
Toml.config_update({plugin = _ENV["!guid"], config = "myconfig"} , params) -- this will create plugin_name/myconfig.toml
The drop_empty_tables flag enables recursive elimination of empty tables inside of the cfg file.
- Saving the config
Toml.save_cfg(_ENV["!guid"], params)
-- or if you have multiple config files
Toml.save_cfg({plugin = _ENV["!guid"], config = "myconfig"}, params)
- Resetting config to default
params = Toml.reset_default(_ENV["!guid"])
-- or
params = Toml.reset_default({plugin = _ENV["!guid"], config = "myconfig"})
- DEPRECATED (still works) Initializing and loading the config
mods.on_all_mods_loaded(function() for k, v in pairs(mods) do if type(v) == "table" and v.tomlfuncs then Toml = v end end
params = {
max_number = 4,
enabled = true
}
params = Toml.config_update(_ENV["!guid"], params) -- Load Save
end)
Special Thanks To
- The Return Of Modding team
- hinyb
Contact
For questions or bug reports, you can find us in the RoRR Modding Server @Miguelito @Umigatari
CHANGELOG
v1.1.0
- Added ENVY support
- Added reset_default
- Added drop_empty_tables flag (hinyb suggestion)
- Changed writing to cfg to only happen once per ImGui frame (hinyb suggestion)
- Added a way to have multiple configs per plugin
- You can specify cfg_name using a table
- save_cfg defaults to save_cfg_internal if called when Imgui is closed
v1.1.1
- Bugfixes and formatting