Correctly handle lua conversion for empty lists.
This commit is contained in:
parent
95e7679c82
commit
feaaf56e54
1 changed files with 12 additions and 9 deletions
|
@ -70,15 +70,18 @@ let
|
||||||
listToLua =
|
listToLua =
|
||||||
list:
|
list:
|
||||||
assert builtins.isList list;
|
assert builtins.isList list;
|
||||||
let
|
if list != [ ] then
|
||||||
wrap = (lib.elemAt list 0) != "__unpack";
|
let
|
||||||
strippedList = if wrap then list else (lib.drop 1 list);
|
wrap = (lib.elemAt list 0) != "__unpack";
|
||||||
in
|
strippedList = if wrap then list else (lib.drop 1 list);
|
||||||
lib.concatStrings [
|
in
|
||||||
(optionalString wrap "{")
|
lib.concatStrings [
|
||||||
(concatStringsSep "," (map toLua strippedList))
|
(optionalString wrap "{")
|
||||||
(optionalString wrap "}")
|
(concatStringsSep "," (map toLua strippedList))
|
||||||
];
|
(optionalString wrap "}")
|
||||||
|
]
|
||||||
|
else
|
||||||
|
"{}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts a nix set into its Lua representation.
|
Converts a nix set into its Lua representation.
|
||||||
|
|
Loading…
Reference in a new issue