> wow!.. I didn't know you could do that.  Is there *any* way 
> to make them private?  I noticed that the component 
> documentation says all the arguments are required, is it 
> possible to declare which arguments are required and which 
> ones aren't?  What else can you do with this... playing with 
> it, it really doesn't seem very flexible, but I still have hope.

You said components above - although we are talking about script based
udfs. For a CFFUNCTION type UDF or METHOD, any <CFARGUMENT> tag w/o a
required setting will default to NOT being required. In a script based
udf, any argument declared is required. For example:

function add(x,y) {
        return x+y;
}

In this UDF, both x and y are required because they are declared. To use
optional arguments, you simply check the size of the arguments array.

function addMore(x,y) {
        var c = 0;
        if(arrayLen(arguments) gte 3) c = arguments[3];
        return x+y+c;
}

Or even

function addALotOfCrap() {
        var total = 0;
        var i = 1;

        for(;i lte arrayLen(arguments);i=i+1) {
                total = total + arguments[i];
        }

        return total;
}

Or even better, if you trust all arguments are numeric: return
arraySum(arguments);

Anyway, you get the idea. For more examples of UDFs, check out
www.cflib.org

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to