From fd40716b581f55e0c0cd6a913d35439bb416bde5 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Sat, 5 Aug 2017 22:55:27 +0700 Subject: [PATCH] print can be used similar to echo --- godot/nim/godotnim.nim | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/godot/nim/godotnim.nim b/godot/nim/godotnim.nim index 01f5b55..bab3dd1 100644 --- a/godot/nim/godotnim.nim +++ b/godot/nim/godotnim.nim @@ -89,15 +89,12 @@ template printError*(error: typed) = let (filename, line) = instantiationInfo() godotPrintError(cstring($error), nil, cstring(filename), line.cint) -proc print*(message: string) {.inline.} = - ## Prints ``message`` to Godot log. - var s = message.toGodotString() - godotPrint(s) - s.deinit() - -proc print*(message: cstring) {.inline.} = - ## Prints ``message`` to Godot log. - var s = message.toGodotString() +proc print*(parts: varargs[string, `$`]) = + ## Prints concatenated ``parts`` to Godot log. + var combined = "" + for v in parts: + combined.add(v) + var s = combined.toGodotString() godotPrint(s) s.deinit()