- Joined
- Feb 27, 2007
- Messages
- 5,578
I realize that there will probably never be an update to JASSHelper or vJASS in wc3 (blah blah Lua is the future old man... yes you're right) but I don't really understand why this produces an error:
.pcs is a static 2d struct array, so I'm just checking if a particular index of that array has been assigned to an allocated struct. What is produced by JASSHelper in the error case is the following:
Edit: Had I thought after I posted this... turns out it's the usage of "not" that is causing JASSHelper to freak out. Without the not, the line does not need () to compile properly. So instead this is just a discussion about this behavior. Should this make sense?
JASS:
//ERROR "Cannot convert integer to boolean"
// "Comparing the order/size of two variables only works on reals and integers"
if not Board.pcs[.x+dx][.y+dy]>0 then
//...
endif
//NO ERROR because of the ()
if not (Board.pcs[.x+dx][.y+dy]>0) then
//...
endif
if not s__s__Board_pcs[(s__Piece_x[this] + dx)*(20)+s__Piece_y[this] + dy] > 0 then
which only compares integers to integers. Is this just a fake error that doesn't actually mean anything or what? Why does enclosing the line in parenthesis make it clear to JASSHelper that only integers are being compared with other integers?Edit: Had I thought after I posted this... turns out it's the usage of "not" that is causing JASSHelper to freak out. Without the not, the line does not need () to compile properly. So instead this is just a discussion about this behavior. Should this make sense?