LuaJIT only, for now.
TOML encoding and decoding for LuaJIT through Rust's serde
and toml
crates.
For the moment, clone the repo, run bash build
from the root, grab toml.so
and put it somewhere in your package.path
.
Returns userdata
on error.
local toml = require('toml')
local data = {
name = 'Toml',
age = 42,
is_cool = true,
likes = { 'lua', 'toml', 'neovim' },
contact = {
email = '[email protected]'
}
}
print(toml.encode(data))
-- age = 42
-- is_cool = true
-- likes = ["lua", "toml", "neovim"]
-- name = "Toml"
--
-- [contact]
-- email = "[email protected]"
Returns userdata
on error.
local decode = toml.decode([[
age = 42
is_cool = true
likes = ["lua", "toml", "neovim"]
name = "Toml"
[contact]
email = "[email protected]"
]])
vim.print(decode)
-- {
-- age = 42,
-- contact = {
-- email = "[email protected]"
-- },
-- is_cool = true,
-- likes = { "lua", "toml", "neovim" },
-- name = "Toml"
-- }