Help with figuring out func.argsmap object. How do I get the arguments supplied to my command?

function foo(input){
	//print(input.func.argsmap(1))			// eror: Subscript out of range (0x800a0009)
	//print(input.func.argsmap[0])			// nothing is printed on script log
	print(input.func.argsmap[1])				// same as above
	
	if (input.func.argsmap.count)			// always prints 1 not matter how many space delimited words i provide to "foo"
		print(1)
	else
		print(0)

}

what I want to do is get whatever words are provided to my command for example, with foo one two three, I want to get one, two, three

I tried following the Map article but I have not had any luck. Also the forum doe not have past questions pertaining to this.

Thanks.

The map takes an argument name, not a position.

I assume we're talking about a script command here, which is then calling foo and passing it a ScriptCommandData object. If so, see the ScriptCommand template member for how to define your command's argument names and template.

If you're still unsure, search the forum for argsmap and it finds at least once example of how it's used:

1 Like

I should have offered a complete example, pardone me. Thanks for the expalantion and link. I am just getting back to this now. I will give a go again!

1 Like