Game Development Community

Passing TorqueScript arrays to ConsoleMethod

by Andy Proctor · in Torque Game Builder · 11/22/2006 (7:01 am) · 2 replies

Is there a way to pass an array from TorqueScript to a ConsoleMethod (and return one back to script)? If so, just pointing me to an example in the C++ source would be much appreciated.

#1
11/22/2006 (3:19 pm)
I don't think there is a built in way to do it automatically because of the way TS arrays are stored and used. You could pass in the name of the var as a string and pass in the length of it and build the var names dynamically in C++ and look each one up there.
#2
11/26/2006 (9:50 am)
If you were using a SimSet instead of an array (the intended design pattern), you could simply pass the objectID of the SimSet, and then iterate over it in your ConsoleMethod.