Skip to content

Commit b60cbe9

Browse files
authored
Update Lua.fs
1 parent 6894113 commit b60cbe9

File tree

1 file changed

+15
-12
lines changed
  • YukimiScript.CodeGen.Lua

1 file changed

+15
-12
lines changed

YukimiScript.CodeGen.Lua/Lua.fs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,21 @@ let generateLua (x: Dom) : string =
3434
.Append(luaCall <| "api." + c.Callee)
3535
.Append("(") |> ignore
3636

37-
c.UnnamedArgs
38-
|> List.map (function
39-
| Symbol "true" -> "true"
40-
| Symbol "false" -> "false"
41-
| Symbol "null" | Symbol "nil" -> "nil"
42-
| Symbol x -> luaCall <| "api." + x
43-
| Integer x -> string x
44-
| Number x -> string x
45-
| String x -> "\"" + Constants.string2literal x + "\"")
46-
|> List.reduce (fun a b -> a + ", " + b)
47-
|> sb.Append
48-
|> ignore
37+
let args =
38+
c.UnnamedArgs
39+
|> List.map (function
40+
| Symbol "true" -> "true"
41+
| Symbol "false" -> "false"
42+
| Symbol "null" | Symbol "nil" -> "nil"
43+
| Symbol x -> luaCall <| "api." + x
44+
| Integer x -> string x
45+
| Number x -> string x
46+
| String x -> "\"" + Constants.string2literal x + "\"")
47+
48+
if not <| List.isEmpty args then
49+
|> List.reduce (fun a b -> a + ", " + b)
50+
|> sb.Append
51+
|> ignore
4952

5053
sb.Append(") end,") |> ignore
5154

0 commit comments

Comments
 (0)