HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

optional parameter in vjass

09-05-2008, 03:01 PM#1
MaD[Lion]
hey vex my good friend... lets go drink some beer ^^
And when ure drunk maybe u can do this for next vjass release :D
This is the default parameter (from PHP and C++ as ive experience with)
Collapse JASS:
function something takes real a, real b=0 returns nothing
  call BJDebugMsg(R2S(a+b))
endfunction

//None should show syntax error
call something(20.5)
call something (16.5,GetUnitFlyHeight(u))

//would be nice to apply to methods too ^^

Idea to how to solve it, when an optional parameter is missing (can only be the last parameters, just give it the default value when someone call the function after parsed into Jass. So the above in jass would be:

Collapse JASS:
call something(20.5,0)
call something(16.5,GetUnitFlyHeight(u))
09-05-2008, 03:04 PM#2
Vexorian
Closing this.

The only reason I have not added it yet is that it is very hard to include it in current jasshelper. Think of it as something for a later compiler. I thought the place for suggestions was jasshelper's thread...