I use one I made a while ago. It is really fast compared to other lua toml implementations and just zips stuff from toml to lua and back. toml-edit isn't slow, this one is just nearing cjson speeds but for toml, but it would only be that fast for TOML to lua, and that is part of why it is so fast.
But it also doesn't pass their test suite because it zips it straight into lua rather than deconstructing every value with its own type tag and stuff. But it is up to spec in terms of doing just toml to lua and back correctly.
In terms of memory use while parsing, it allocates only a single buffer for parsing, and then also the lua object it is creating, for its entire parsing sequence.
I just wanted a fast one that worked the way I wanted it to for quick tasks IDK. Pretty sure toml-edit is usually still the way to go, unless you are just reading mostly. It has a nice little cli command that might be useful for a task which is small but which needs config? IDK. I also just felt the need to write a fast parser in C and like TOML.
I wouldn't recommend using it for something really important because who knows if I will ever update it lol it has like 4 stars, clearly nobody cared XD
No, I meant something like Starlark, not lua-cjson, the point is to generate some data structure (be it json or native tables/lists/whatevers in given language in the end) from 'code'. Starlark is Python-like, and unlike JSON, YAML, TOML, etc. can have loops, variables, etc. but also makes it safe to execute untrusted code (unlike Lua, except with careful sandboxing, or Python).
I have never heard of starlark. Also, you said lua -> json so I thought you meant lua TO json. Not like, some lua json mashup.
How does it make it safe to execute untrusted code? That doesn't sound very safe, does it have its own sandbox? Can it not do stuff like run other programs?
Yes, it's sandboxed (and can't touch filesystem, network, etc.) and Lua -> JSON was only example, the point is to have some code -> data structure thing, like Lua sandboxing inside luarocks was.
View all comments
Show parent comment
1
u/no_brains101 Oct 26 '26 edited Oct 26 '26
Is that not lua-cjson?
Also you don't want JSON configs.
TOML. this one is popular:
https://github.com/lumen-oss/toml-edit.lua
---
I use one I made a while ago. It is really fast compared to other lua toml implementations and just zips stuff from toml to lua and back. toml-edit isn't slow, this one is just nearing cjson speeds but for toml, but it would only be that fast for TOML to lua, and that is part of why it is so fast.
But it also doesn't pass their test suite because it zips it straight into lua rather than deconstructing every value with its own type tag and stuff. But it is up to spec in terms of doing just toml to lua and back correctly.
https://github.com/BirdeeHub/tomlua
In terms of memory use while parsing, it allocates only a single buffer for parsing, and then also the lua object it is creating, for its entire parsing sequence.
I just wanted a fast one that worked the way I wanted it to for quick tasks IDK. Pretty sure toml-edit is usually still the way to go, unless you are just reading mostly. It has a nice little cli command that might be useful for a task which is small but which needs config? IDK. I also just felt the need to write a fast parser in C and like TOML.
I wouldn't recommend using it for something really important because who knows if I will ever update it lol it has like 4 stars, clearly nobody cared XD