I just realised what an eejit I was with my first solution (close but no
cigar). The following 'TestMe' function will work when either named OR
unnamed arguments are passed to it:
<cffunction name="testMe" output="1">
<cfset var arg = "">
<cfset var argList = "">
<cfset var aKeys = StructKeyArray(arguments)>
<cfdump var="#arguments#">
<!--- named or no arguments --->
<cfif not ArrayLen(aKeys) or not IsNumeric(aKeys[1])>
<cfinvoke method="testMe2" argumentCollection="#arguments#">
<!--- unnamed arguments --->
<cfelse>
<cfloop collection="#arguments#" item="arg">
<cfset argList = ListAppend(argList, 'arguments["#arg#"]')>
</cfloop>
<cfset Evaluate('testMe2(#argList#)')>
</cfif>
</cffunction>
<cfoutput>
<p> No arguments:</p>
#testMe()#
<p> One unnamed argument:</p>
#testMe("hello")#
<p> Two named arguments:</p>
#testMe(foo="hello", one="foo")#
</cfoutput>
Dominic
--
Blog it up: http://fusion.dominicwatson.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:303858
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4