Ah, I did know about overloading from Java, just forgot the technical term =)
Why can't I do this in BlitzMax? Is there any special reason?
Some ideas of mine:
Can't I use casting to check if the first parameter is a Vector then do.. or if an int then.. I think it would be possible to take an aproach like this but I'm afraid it will get messy.
Is there a way I can pass an array with 2 slots in to the function and by this make the Vector take as much space as my (X,Y). So that I in some way would do it like this:
Function CreateCar([X,Y],Color,Name$)
and when I use it I could do something like this:
CreateCar([X,Y],Color,Name$)
or with a vector
CreateCar(Location,Color,Name$)
The idea is to, inside the function, check if the argument is an array or a vector.
-
Perhaps I could make a function that accepts X,Y and returns a temporary vector. So that I could CreateCar(Poss(X,Y),Color,Name$)
I haven't tried any of these and I'm unsure if they would work. Is there a way to find a solution to this or should I just use two different but identical functions? Which I have a hard time accepting =)
Why can't I do this in BlitzMax? Is there any special reason?
Some ideas of mine:
Can't I use casting to check if the first parameter is a Vector then do.. or if an int then.. I think it would be possible to take an aproach like this but I'm afraid it will get messy.
Is there a way I can pass an array with 2 slots in to the function and by this make the Vector take as much space as my (X,Y). So that I in some way would do it like this:
Function CreateCar([X,Y],Color,Name$)
and when I use it I could do something like this:
CreateCar([X,Y],Color,Name$)
or with a vector
CreateCar(Location,Color,Name$)
The idea is to, inside the function, check if the argument is an array or a vector.
-
Perhaps I could make a function that accepts X,Y and returns a temporary vector. So that I could CreateCar(Poss(X,Y),Color,Name$)
I haven't tried any of these and I'm unsure if they would work. Is there a way to find a solution to this or should I just use two different but identical functions? Which I have a hard time accepting =)