Originally Posted By: 3run
Thank you for pointing this out! laugh

BTW, it works without typecasting, I mean without (long), while manual says that's it important to typecast var to double or long.. Anyway why it's needed?

Best regards


well , gamestudio automatically converts most variables of type var , to most of the correct needed types , however the var type itself is different as you know , the "var" type is almost an all rounder in litec , it can be a number a handle a pointer , as a number it could become an int or whatever automatically done by gamestudio where it knows the type it has to be casted/converted to , however this particular case i took it as ,implicitly instructing /controlling the type , because functions like printf can support multiple types it wouldn't be obvious to the engine what type I need , I have to tell it exactly what I want.

in this case there were no actual "var" instead there were purely "int" types used , but "int" and "long" are also much the same thing , but printf accepts char* , int , and double no var or float support for arguments (according to manual) so therefore you need to typecast "var" to long for integers and double for non-integers explicitly .

I really did not need to cast , just a habbit which I dragged along with me ,because of the var type I had to get used to , and it stuck ,that plus to me %I make sense more than %d..


Compulsive compiler