Game Development Community

About struct, struct array and string array

by qiansheng · in Torque 3D Professional · 01/08/2013 (11:46 pm) · 2 replies

I want to export data from C++ to script. But it seems that I cannot declare a struct, a struct array or a string array in the script. This meams that I can not export struct or struct array easily.

I really don't know how to solve this problem.

#1
01/09/2013 (2:33 am)
What data? You could use SimObjects as containers. But without knowing the data I can only conjecture.
#2
01/09/2013 (5:28 am)
@iansheng - If you want to create a new object to expose to TorqueScript, you will have to create a class and expose is as a console object. For a string, you can add it using Con::addVariable("name", type, &variableReference).

If you want to create a custom object in script, I'd advise against using a SimObject. It is not intended to be instantiated in TorqueScript. Use a ScriptObject instead.