Posted By: Chameleon_Man
Passing by reference/value - 12/08/07 17:47
In c-script, how do I pass a var by reference and value? What about making a function return a value? Thanks.
Posted By: Chameleon_Man
Re: Passing by reference/value - 12/08/07 20:30
Error(0): Syntax error - local var can't be passed as vector.
I get this error when I try to pass as reference. My code looks a little like this...
Function Main {
var momentum=0;
jump(momentum);
}
Function jump(&momentum) {
...
}
Posted By: EpsiloN
Re: Passing by reference/value - 12/09/07 04:46
Local vars are vars that have been created insinde the function.
Move 'var momentun=0;' before your function main() and it'll work. (This way you'll make it a global var)
Posted By: Chameleon_Man
Re: Passing by reference/value - 12/09/07 06:16
That's a quick fix to the problem, but I'd like to avoid using global variables. Too many globals are a sign of bad programming...