It looks like you're new here. If you want to get involved, click one of these buttons!
<<set _array to $args>>
<<set _number to $args>>
<<if _array and _number is 6>>
<<print "<script>console.log('var1: " + $args + "');</script>">>
<<set _var to $args>>
console.log('var2: ' + State.temporary["var"]);
<<set _list to ["A", "B", "C"]>>
JasoninMN wrote: »
I had been trying to use State.variables.args, but without success.
console.log('var1: ' + State.variables["args"]);
To get an array out of an array, just include another index:
Personally, I don't like to work with mysteriously named variables, so consider giving them better names using temp variables inside the widget:
There are a number of ways around this issue depending on exactly what you are trying to do, two of them being:
You can pass an array to a widget using a variable like so:
Is Chapel's suggestion to use State.variables.args contradicted by greyelf's observations about scope? I had been trying to use State.variables.args, but without success.
greyelf, I don't understand your first approach. I might be able to if I spend more time trying to parse it.
I'm not sure how the scope is changed like that, even after looking at the source code, since it looks like the macro uses the State object to set it all up. I would also be interested in why that happens.