Edit toml files while preserving whitespace and formatting from Lua.
local toml_content = [[
[rocks]
# Some commment
"toml-edit" = "1.0.0"
]]
local toml_edit = require("toml-edit")
local toml_tbl = toml_edit.parse(toml_content)
toml_tbl.rocks["toml-edit"] = "2.0.0"
local new_content = tostring(toml_tbl)
Using Nix:
nix flake check -L
Using luarocks:
mkdir luarocks
luarocks make --tree=luarocks
luarocks test