1) Give a description of the problem
I am trying to iterate through the $args key-value pairs passed to a piston by calling its external URL. Essentially I have a variable number of arguments, e.g.
Most examples I see put the arguments into a local variable by name (e.g. $args.arg1, arg2, …)
However, I would like to use a loop that iterates through the list of supplied arguments that I gave on the URL as I don’t know in advance how many were supplied. There seems to be no documentation on $args, and some examples I see really don’t do this.
2) What is the expected behaviour?
for i=0; i<$args.length; ++i
extract the keyname in $args[i] // eg arg1
extract the value in $args[i] // eg val
3) What is happening/not happening?
Failing to figure out the length of $args
Tried length($args) and $args.length none seem to give the right amount so i don’t exceed the arrayItem(n, $args) n value for the array
I also see that there are a number of “invisible” arguments passed (e.g. param1, param2, …) that come along with the argument list, so I need to know to stop iterating when I hit these
Also not sure how to extract the key and value for each arg without doing a lot of string manipulation (e.g. to the left of the : is the key, to the right is the value)
THANKS in advance!