Search Unity

JS Parameter Assignment Expression

Discussion in 'Scripting' started by Jonathan Czeck, Sep 13, 2005.

  1. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    That would be default parameter values...

    This is not (yet?) supported by Unity Javascript, but you could do something like this instead:

    Code (csharp):
    1.  
    2. function Edit ( clear : boolean ) { ...yada yada... }
    3. function Edit () { return Edit(false); }
    4.  
     
  3. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Ah... good idea.

    (And that's the word for it.. was on the tip of my tongue ;) )

    Thanks,
    -Jon
     
  4. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148

    ... and my solution used what's called "multi-method dispatch"... iirc :p