- Joined
- Sep 26, 2009
- Messages
- 9,496
Wow default return values, World Editor what have u done!
Wow default return values, World Editor what have u done!
/*
Wc3 version : 1.26.0.6401
OS : windows 7 , 64 bits
text displayed :
begin
end of condition without return value
second condition
end of condition without return value
second condition
end of condition without return value
second condition
end of condition without return value
second condition
b == false
b2 == true
b3 == false
*/
function Bool takes integer i returns boolean
if i == 0 then
return false
elseif i == 1 then
return true
endif
endfunction
function Cond takes nothing returns boolean
local integer i = 42
if i == 0 then
return false
elseif i == 1 then
return true
endif
call BJDebugMsg("end of condition without return value")
endfunction
function Cond2 takes nothing returns boolean
call BJDebugMsg("second condition")
return true
endfunction
function Act takes nothing returns nothing
call BJDebugMsg("actions")
endfunction
function InitTrig_test takes nothing returns nothing
local boolean b
local boolean b2 = true
local boolean b3 = false
local trigger trig = CreateTrigger()
call TriggerAddCondition(trig,Filter(function Cond))
call TriggerAddCondition(trig,Filter(function Cond2))
call TriggerAddAction(trig,function Act)
call TriggerRegisterPlayerChatEvent(trig,GetLocalPlayer(),"test",false)
call BJDebugMsg("begin")
call BJDebugMsg(" ")
if TriggerEvaluate(trig) == true then
call TriggerExecute(trig)
endif
if TriggerEvaluate(trig) then
call TriggerExecute(trig)
endif
call TriggerEvaluate(trig)
set b = TriggerEvaluate(trig)
call BJDebugMsg(" ")
if b == true then
call BJDebugMsg("b == true")
elseif b == false then
call BJDebugMsg("b == false")
else
call BJDebugMsg("undetermined")
endif
set b2 = Bool(42)
if b2 == true then
call BJDebugMsg("b2 == true")
elseif b2 == false then
call BJDebugMsg("b2 == false")
else
call BJDebugMsg("undetermined")
endif
set b3 = Bool(42)
if b3 == true then
call BJDebugMsg("b3 == true")
elseif b3 == false then
call BJDebugMsg("b3 == false")
else
call BJDebugMsg("undetermined")
endif
call BJDebugMsg("end")
call BJDebugMsg(" ")
endfunction
I'm not sure what you mean by the thread crashing with no valid return value - if it displayed some values for b2 and b3 then it means the thread didn't crash. What is confusing is that it displayed b2 == true but b3 == false??? When they both called the same thing -_-
'\\'
'\''
I do get that but you can't have JH without pJass last I checked.
What it does?
It nicing you?
1 + 1*3 + 6 - 2/1*6
1+1 * 3+6-2 / 1 * 6
1+1*3+6-2/1*6
1 + 1*3 + 6 - 2/1*6
1 + 1 * 3 + 6 - 2 / 1 * 6
JASS:1 + 1 * 3 + 6 - 2 / 1 * 6 1+1 * 3+6-2 / 1 * 6 1+1*3+6-2/1*6 1 + 1*3 + 6 - 2/1*6 //Correct
1 + (1*3) + (6 - ((2/1)*6)) //Correct
Do you know how annoying it is to lose track of parenthesis while coding? Better to just rely on precedence.
I think that we need to have a discussion with the JASS experts in the community before we decide on a naming convention for add/remove.
I can give examples of resources from the wc3c snobs that use standard operation names and add/remove names.
JASS only uses add/remove because each of their collections only supports one operation. In the case of a collection that supports only a single add operation and a single remove operation, add/remove do indeed make sense. I think that justifying add/remove be part of all collections given the limited scope of the collections present in JASS is a weak assertion at best.
create/destroy and allocate/deallocate are obvious because they are the standard method names used by jasshelper. It doesn't make sense to use new/delete in this case because the language that these operations are being written for use different names.
I am also going to point out that there are 2 collections that have multiple add operations, these add operations being based on type. Instead of Add, they use Save/Store.
I would stay away from trying to enforce collection operation names unless we get a pretty overwhelming consensus from the community on what the names should be, like with the case of create/destroy.
I also don't know that the "math" spacing thing should be in the JPAG, or rather if it is, it should be marked as optional. There is no overwhelming consensus on how math operations should be spaced.
I recommended "Ex" because this has been used in every case when expanding on an existing function. I'm not sure who started it, but everyone uses it now. The same can't be said for add/remove, either in the JASS language, in jasshelper, or in the users of the language.
Thanks, ^_^
exitwhen null == FoG
vs exitwhen FoG == null