On Thu, 3 Mar 2005 13:30:29 -0500, Adam Haskell <[EMAIL PROTECTED]> wrote:
> If I have option values I do this
> function bob(required)
> {
>     var optional = '';
>     if (arraylen(arguments) EQ 2)
>        optional = arguments[2];
> .......
> }
> 
> I think you will find this common practice if you look trhough a good
> chunk of the UDFs on cflib.org.
> 
> Adam H
> 

Ahh, excellent...

THANK YOU. I hadn't gotten around to messing with it further. I was
planning to send 3 args to a function with one arg defined, then use
"return arguments;" and a CFDUMP to see exactly what I got back.

>From that perspective, you could create a var'ed structure, loop the
arguments structure and write all the argument variables to the local
structure, and then use structKeyExists for detecting their presence
for conditional processing:

<cfscript>
function myFunction() {
                var myContainer = structNew();
                
                for (i in arguments) {
                                myContainer[i] = arguments[i];
                        }
        
                if (structKeyExists(myContainer,"argumentName")) {
                                {code here}
                        }
                else {
                                {other code here}
                        }
        }
</cfscript>

Laterz,
J

-- 
Continuum Media Group LLC
Burnsville, MN 55337
http://www.web-relevant.com
http://cfobjective.neo.servequake.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197387
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to