arrays as parameters

BlitzMax Forums/BlitzMax Programming/arrays as parameters

Ghost Dancer(Posted 2008) [#1]
I am trying to create a method that will accept any number of string parameters. To my knowledge there is no native way of doing this in Max (but please correct me if I am wrong) so I thought I could work around this by using array parameters. e.g.

Method test(param$[])
  'some code
End Method


Now it works if I use it like this:

Local arr$[] = ["one", "two"]
test arr$


but I'm not sure of the syntax to pass the array values directly without having to declare the array first (doing it this way may work but it is a bit messy). Does anyone know if this can be done, or if there is another/better way of doing this?


degac(Posted 2008) [#2]
test(["one","two"]

?


Ghost Dancer(Posted 2008) [#3]
I had already tried

test ["one","two"] 


which resulted in a compiler error, but

test (["one","two"]) 


does work, so thanks :)