Passing A Variable Number Of "Nameless" Arguments Using CFInvoke And ArgumentCollection

<!---
	Create an argument collection of girls. The
	purpose of this is to build up a variable number
	of "nameless" arguments.
--->
<cfset objArgs = StructNew() />
 
<!---
	Loop over the girls to figure out which ones we
	want to pass in. For now, let's get all the 9.0
	who are also brunette.
--->
<cfloop
	item="strGirl"
	collection="#objGirls#">
 
	<!--- Get a reference to the girl. --->
	<cfset objGirl = objGirls[ strGirl ] />
 
	<!--- Check to see if this girl makes the cut. --->
	<cfif (
		(objGirl.Hair EQ "Brunette") AND
		(objGirl.Hotness EQ 9.0)
		)>
 
		<!---
			We want to include this girl in our argument
			collection. In order to do that we are going to
			add her to the argument collection struct with an
			index-based naming convention so that the function
			will use it like an array. In order to do this
			dynamically, we can use the struct-count to get
			the current index.
		--->
		<cfset objArgs[ StructCount( objArgs ) + 1 ] = objGirl />
 
	</cfif>
 
</cfloop>
 
 
<!---
	Now that we have built up the argument
	collection, we can simply invoke the method and pass
	in the arguments struct.
--->
<cfinvoke
	method="DumpArgs"
	argumentcollection="#objArgs#"
	/>

For Cut-and-Paste