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