Game Development Community

TGB Return Question

by Justin Proffitt · in Game Design and Creative Issues · 07/09/2009 (10:45 am) · 0 replies

I have written a function for calculating where an object, given a certain velocity, will be in x milliseconds. However I noticed that you cannot return more than one value from a function. I see there are ways to get around this in real programming languages such as C++, java, etc., and functions like getPosition() suggest it is possible in torquescript, but I cannot figure out how. Any help would be appreciated.

Oh, and I do not own the source code so I cannot simply look at the functions that return multiple values :/

Edit: I appear to have figured it out, declare multiple values separated by spaces to a single string, then return that and use the getword function to get one or the other value from it.

About the author

I am a college student majoring in physics. As it so happens I like programming, a hobby which extends my profession in web design.