# luck
lib Adder:
int Add(int a, int b[, int c]):
print a+b+c
onInit:
Add(1,2)
Add(1,2,3)
# endluck
// * these variables should be generated by LuckyParser prior to script optimization
// so that they are destroyed automatically if unused. Merge globals as the second
// to last process (after final vanilla syntax check) btw
globals
integer SUPER_DEFAULT_INTEGER = 0 // fun fact, ALL types in JASS extend these guys
real SUPER_DEFAULT_REAL = 0.00
code SUPER_DEFAULT_CODE = null
handle SUPER_DEFAULT_HANDLE = null
string SUPER_DEFAULT_STRING = ""
endglobals
// * also, globals should not be able to be prefixed by _ in Luck, as they are
// reserved for superglobals (those used by the compiler) and SUPER_ is also
// not allowed,
// * the above luck code will become this upon compilation, and Luck should also
// do "TriggerAddCondition(_INITTRIG,Condition(Adder__3729_onInit))"
function Adder__3729_Add takes integer a, integer b, integer c returns integer
return a+b+c
endfunction
function Adder__3729_onInit takes nothing returns boolean // I would hope you are going to use a global boolexpr for initilization functions
call Add(1,2,SUPER_DEFAULT_INTEGER) // a third value was not supplied so append one
call Add(1,2,3) // a third value WAS supplied so do not append one
return false
endfunction