lz.n: generate less code

This commit is contained in:
Ching Pei Yang 2024-08-03 19:48:13 +02:00 committed by Pei Yang Ching
parent 5002e25c1d
commit 118f33f1fc

View file

@ -40,15 +40,21 @@
end
''
else null;
after = mkLuaInline ''
function()
${
optionalString (spec.setupModule != null)
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
}
${optionalString (spec.after != null) spec.after}
end
'';
after =
if spec.setupModule == null && spec.after == null
then null
else
mkLuaInline ''
function()
${
optionalString (spec.setupModule != null)
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
}
${optionalString (spec.after != null) spec.after}
end
'';
keys =
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
then map toLuzLznKeySpec spec.keys