diff --git a/lib/to-lua.nix b/lib/to-lua.nix index 3fcda4bd..d02ba768 100644 --- a/lib/to-lua.nix +++ b/lib/to-lua.nix @@ -43,7 +43,7 @@ rec { "{ }" else "{" - + (concatStringsSep "," ( + + (concatStringsSep ", " ( mapAttrsToList ( n: v: let @@ -63,7 +63,7 @@ rec { )) + "}" else if builtins.isList args then - "{" + concatMapStringsSep "," toLuaObject args + "}" + "{" + concatMapStringsSep ", " toLuaObject args + "}" else if builtins.isString args then # This should be enough! builtins.toJSON args diff --git a/tests/lib-tests.nix b/tests/lib-tests.nix index e89d97ba..e512661a 100644 --- a/tests/lib-tests.nix +++ b/tests/lib-tests.nix @@ -55,7 +55,7 @@ let 3 ]; }; - expected = ''{foo = "bar",qux = {1,2,3}}''; + expected = ''{foo = "bar", qux = {1, 2, 3}}''; }; testToLuaObjectRawLua = { @@ -68,7 +68,7 @@ let "__unkeyed...." = "foo"; bar = "baz"; }; - expected = ''{"foo",bar = "baz"}''; + expected = ''{"foo", bar = "baz"}''; }; testToLuaObjectNestedAttrs = { @@ -81,7 +81,7 @@ let }; }; }; - expected = ''{a = {b = 1,c = 2,d = {e = 3}}}''; + expected = ''{a = {b = 1, c = 2, d = {e = 3}}}''; }; testToLuaObjectNestedList = { @@ -98,7 +98,7 @@ let ] 7 ]; - expected = "{1,2,{3,4,{5,6}},7}"; + expected = "{1, 2, {3, 4, {5, 6}}, 7}"; }; testToLuaObjectNonStringPrims = { @@ -109,7 +109,7 @@ let d = false; e = null; }; - expected = ''{a = 1.000000,b = 2,c = true,d = false}''; + expected = ''{a = 1.000000, b = 2, c = true, d = false}''; }; testToLuaObjectNilPrim = { @@ -150,7 +150,7 @@ let g = helpers.emptyTable; }; }; - expected = ''{c = { },d = {g = { }}}''; + expected = ''{c = { }, d = {g = { }}}''; }; testToLuaObjectQuotedKeys = { @@ -160,7 +160,7 @@ let c = "c"; d-d = "d"; }; - expected = ''{["1_a"] = "a",_b = "b",c = "c",["d-d"] = "d"}''; + expected = ''{["1_a"] = "a", _b = "b", c = "c", ["d-d"] = "d"}''; }; testIsLuaKeyword = {