afisakov
You can change this now in User CP.
- Reaction score
- 37
I have seen some maps that write functions in this form
I am tempted to write it like this instead
I have no doubt that the second approach saves space, but I am wondering if it somehow slows down the execution. Otherwise I don't know why the first would be used except that is how game translates it from GUI.
Are there any advantages to the first approach or should I switch to the second (conditions written inside the function that uses them)?
Code:
function Trig_kongzhi_Func005C takes nothing returns boolean
if(not(GetUnitTypeId(GetTriggerUnit())=='ndqp'))then
return false
endif
return true
endfunction
function Trig_kongzhi_Func006C takes nothing returns boolean
if(not(GetUnitTypeId(GetTriggerUnit())=='ndqs'))then
return false
endif
return true
endfunction
function Trig_kongzhi takes nothing returns nothing
if Trig_kongzhi_Func005C() then
do something
endif
if Trig_kongzhi_Func006C() then
do something else
endif
...
Code:
function Trig_kongzhi takes nothing returns nothing
if (GetUnitTypeId(GetTriggerUnit())=='ndqp')then
do something
endif
if (GetUnitTypeId(GetTriggerUnit())=='ndqs') then
do something else
endif
...
Are there any advantages to the first approach or should I switch to the second (conditions written inside the function that uses them)?