mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 10:21:31 +00:00
feat: implement freeform smartcolumn column positions
This commit is contained in:
parent
c6bcc873a6
commit
2cfeb22764
5 changed files with 48 additions and 38 deletions
22
lib/lua.nix
22
lib/lua.nix
|
@ -1,12 +1,32 @@
|
|||
# Helpers for converting values to lua
|
||||
{lib}: {
|
||||
{lib}: rec {
|
||||
# yes? no.
|
||||
yesNo = value:
|
||||
if value
|
||||
then "yes"
|
||||
else "no";
|
||||
|
||||
# Convert a null value to lua's nil
|
||||
nullString = value:
|
||||
if value == null
|
||||
then "nil"
|
||||
else "'${value}'";
|
||||
|
||||
# Helper function to convert an attribute name to a Lua table key
|
||||
attrToKey = name: name;
|
||||
|
||||
# Function to convert a Nix attrset to a Lua table
|
||||
attrsetToLuaTable = attrset:
|
||||
"{ "
|
||||
+ (
|
||||
builtins.concatStringsSep ", "
|
||||
(builtins.attrValues (
|
||||
builtins.mapAttrs (
|
||||
name: value:
|
||||
attrToKey name + " = " + ("\"" + builtins.toJSON value + "\"")
|
||||
)
|
||||
attrset
|
||||
))
|
||||
)
|
||||
+ " }";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue