Hmm, it appears you have to use parentheses after your method name when assigning the return value of a method to an integer:
This does not work:
A = ThisSprite.Order
Error:
Unable to convert Int(Int) to Int
I think what it is doing is trying to assign a function/method pointer to A if I don't add the parentheses.
The second problem is that apparently, as far as BlitzMax is concerned, 0 and Null are the same thing. So I cannot use the lack of a value being passed to a function to trigger a different behavior.
Also, it's looking like this is just making the behavior of the code more confusing. It doesn't matter how elegant the solution is if people coming upon it for the first time have a hard time wrapping their heads around what is going on.
Type Sprite Method Order:Int(NewValue:Int=Null) Global Value:Int If NewValue <> Null Then Value = NewValue Return Value End Method End Type ThisSprite:Sprite = New Sprite ThisSprite.Order(10) A = ThisSprite.Order() Print A A = ThisSprite.Order() Print A ThisSprite.Order(0) A = ThisSprite.Order() Print A
This does not work:
A = ThisSprite.Order
Error:
Unable to convert Int(Int) to Int
I think what it is doing is trying to assign a function/method pointer to A if I don't add the parentheses.
The second problem is that apparently, as far as BlitzMax is concerned, 0 and Null are the same thing. So I cannot use the lack of a value being passed to a function to trigger a different behavior.
Also, it's looking like this is just making the behavior of the code more confusing. It doesn't matter how elegant the solution is if people coming upon it for the first time have a hard time wrapping their heads around what is going on.