repr works better than $ in macros.
cool, thanks for another solution!
or you can use intVal, strVal, etc on literal nodes
import macros
macro initNui(a:int): typed =
result = parseStmt("const b=" & $a.intVal)
initNui(1)
many thanks, it works! (I'll try to search and read about static types)
add static to the type
import macros
macro initNui(a: static[int]): typed =
result = parseStmt("const b = " & $a)
initNui 1
Hello. I tried to represent int to string inside a macros:
import macros
macro initNui(a:int): typed =
result = parseStmt("const b=" & $a)
initNui(1)
but I had compilcation error:
unhandled exception: false Invalid node kind nnkIntLit for