I have a JavaScript function which returns an JavaScript array, e.g.
function give_me_three (dummy) {
return ["one", "zwei", "trois"]
}
How can I call this function in Nim? I all sorts of ways to make it work, the best (I think) is:
proc give3(val: cstring): seq[cstring] {.importjs: "give_me_three(#)".}
let three = give3("dummy")
it compiles, but doesn't seem to call give_me_three in the result correctly.
What's the best way to pass a array back as sequence?
The code you gave seems to work correctly, and so does this:
proc give3(val: cstring): seq[cstring] {.importc: "give_me_three".}
What's the problem?