lib/util: move docs from lib/index to doc-comments

Moved all function-specific docs from `docs/lib/index.md` into RFC145
doc-comments.

Added `lib.nixvim.lua.toLuaObject` to hold the public docs and serve as
a stable impl of `toLua'` in case we decide to change its defaults.
This commit is contained in:
Matt Sturgeon 2025-05-15 16:12:26 +01:00
parent 4a272ca5d7
commit f4a7447d27
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
4 changed files with 64 additions and 46 deletions

View file

@ -38,6 +38,21 @@ rec {
# Whether the value is a lua-inline type
isInline = v: v._type or null == "lua-inline";
/**
Serialise a nix value as a lua object.
Useful for defining your own plugins or structured config.
# Type
```
toLuaObject :: Any -> String
```
*/
toLuaObject =
# toLua' with backwards-compatible options
toLua' { };
# toLua' with default options, aliased as toLuaObject at the top-level
toLua = toLua' { };