helpers/toLuaObject: add support for raw keys

This commit is contained in:
Gaetan Lepage 2024-05-31 10:00:53 +02:00 committed by Gaétan Lepage
parent 29922e13f7
commit 03c5f5eb74

View file

@ -15,12 +15,17 @@ rec {
+ (concatStringsSep "," ( + (concatStringsSep "," (
mapAttrsToList ( mapAttrsToList (
n: v: n: v:
if (builtins.match "__unkeyed.*" n) != null then let
toLuaObject v valueString = toLuaObject v;
in
if hasPrefix "__unkeyed" n then
valueString
else if hasPrefix "__rawKey__" n then
"[${n}] = " + valueString
else if n == "__emptyString" then else if n == "__emptyString" then
"[''] = " + (toLuaObject v) "[''] = " + valueString
else else
"[${toLuaObject n}] = " + (toLuaObject v) "[${toLuaObject n}] = " + valueString
) (filterAttrs (n: v: v != null && (toLuaObject v != "{}")) args) ) (filterAttrs (n: v: v != null && (toLuaObject v != "{}")) args)
)) ))
+ "}" + "}"