Game Development Community

How to make Script Function Arguments call by Reference?

by Yui Chung, Ng · in Torque Game Engine · 11/28/2002 (11:26 am) · 1 replies

Hi Everyone,

I brought the Game Engine for about a year. But still can't catch up with the scripting language it uses.

Here is some of my biggest problems:


1. It is any way to make a script function accept call-by-reference-parameters?


2. I found some variables which does not start with
'$' or '%' sign. what does it mean? are those variables global or local?


3. the constructor syntax is differenc form the c++ one.
e.g.
%conn = new GameConnection(ServerConnection);

in the above case, '%conn' is the local variable point the a created instance of a class named 'GameConnection'. Then what does 'ServerConnection' mean?


4. continue from the 3rd question. how about the meaning of a function like:
ServerConnection.prepDemoRecord();


I seacrhed for the answer for a long time but no found.
Would anyone Kindly tell me the answer or suggest some good resources?

Thanks a lot!!

#1
11/28/2002 (8:12 pm)
1. Not really, but you can pass an object to a script function, and the members of the object can be changed. This part of the language is a lot like Java, in terms of function arguments.

2. They are global constants.

3. As I understand it, ServerConnection is the name of that particular connection. It's _not_ a parameter to a constructor.

4. Given my guess on #3, I'd venture that that's a method call on the ServerConnection object made earlier.

Hope this helps! (Tell me if I'm wrong ;)