Question whit types variables as arguments.

Previous topic - Next topic

mentalthink


Hi well the question it´s this, I don´t know how put the argument in the function...

Well in example in EntytySystem I found a example:

EntityAddInternal%: e AS T3DEntity

Well this say e it´s of type T3DEntity, but if I want to put some valor to e, always I have an error....

And another question, becuase always the Masters put the EntityAddInternal% and not EntityAddInternal, I don´t understand well this little diference, because if I wrote EntityAddInternal% in the main code, don´t runs, I have a compiler error... (% it´s for integer numbers, not?¿)

Sorry, perhaps the question it´s resolved yet, but I found in some cases, and I don´t found a correct solutions...

Kinds Regards, and thanks as always...

Kitty Hello

a function with an postfix "%" returns an integer.
You can, however, not call a function
foo%(123), but only foo(123)
it's a bit silly, but I didn't get the compiler to understand that, yet.

mentalthink

Thanks Gernnot, but this part of the above question?¿...

//PREVIOUS POST
Code (glbasic) Select
Well in example in EntytySystem I found a example:

EntityAddInternal%: [color=blue]e[/color] AS T3DEntity

Well this say e it´s of type T3DEntity, but if I want to put some valor to e, always I have an error....


in the e argument, how I can change the value, or I have to leave the function, whitout tell it any parameter... So I try sometimes make this variable equal than type, or make some experiments, but really I don´t understand very good how works the arguments and the types inner the function...


Kitty Hello

Code (glbasic) Select

TYPE TT
   number
ENDTYPE

LOCAL xy as TT
xy.number = 1
foo(xy)
DEBUG "xy.number is now: "+xy.number+"\n"
END

FUNCTION foo: t AS TT
  DEBUG "t.number is: "+t.number+"\n"
 
   t.number = 123
ENDFUNCTION


Does this make sense?


mentalthink

Hi Mrtatoad Thanks...

This it´s the part of your book a read more times than others...
Thanks again...