I've set a function with variable arguments:
myfunc: (cmd, args...)->
# cmd is a string
# args is an array
And can be called like:
myfunc("one") # cmd = "one", args = undefined
myfunc("one","two") # cmd = "one", args = ["two"]
# etc...
Now, what if I want to call it with unknown number of arguments?
Let's say I want to pass an array of args instead of arg1, arg2, arg3,.. how is that possible?
Trying myfunc("one",["two","three"]) or myfunc("one",someArgs) leads to the unfortunate:
# cmd = "one"
# args = [ ["two","three"] ];
Ideas?
P.S. I made it this to work by adding these ultra-simple lines in my function. But is there no other way?
if args? and args[0] instanceof Array
args = args[0]