docs: add comments to lua converters

This commit is contained in:
NotAShelf 2023-06-05 21:37:12 +03:00
parent 9781a1071d
commit 6891c86c58
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22

View file

@ -12,6 +12,7 @@
then "nil" then "nil"
else "'${value}'"; else "'${value}'";
# convert an expression to lua
expToLua = exp: expToLua = exp:
if builtins.isList exp if builtins.isList exp
then listToLuaTable exp then listToLuaTable exp
@ -19,9 +20,11 @@
then attrsetToLuaTable exp then attrsetToLuaTable exp
else ("\"" + builtins.toJSON exp + "\""); else ("\"" + builtins.toJSON exp + "\"");
# convert list to a lua table
listToLuaTable = list: listToLuaTable = list:
"{ " + (builtins.concatStringsSep ", " (map expToLua list)) + " }"; "{ " + (builtins.concatStringsSep ", " (map expToLua list)) + " }";
# convert attrset to a lua table
attrsetToLuaTable = attrset: attrsetToLuaTable = attrset:
"{ " "{ "
+ ( + (