Arrays and string manipulation in Torque3D 1.1beta1
by Jules · in Torque 3D Professional · 02/18/2010 (11:50 am) · 3 replies
What's the procedure for creating and obtaining the values of arrays in Torque 3D ? Would the following resource cause any issues if added or replaced by what is already in arrayObjects ? www.torquepowered.com/community/resource/view/4711/4#comments
Is there also such a command to split a string into an array? e.g
%array = strSplit($message, "~");
if $message contained test1~test2~test3
Then call it back via
value1 = %array.getValue(0);
value2 = %array.getValue(1);
value3 = %array.getValue(2);
Does getValue exist in stock Torque, or do I need to go down the c++ route? Just don't want to over complicate things when functionality exists.
Thanks
Is there also such a command to split a string into an array? e.g
%array = strSplit($message, "~");
if $message contained test1~test2~test3
Then call it back via
value1 = %array.getValue(0);
value2 = %array.getValue(1);
value3 = %array.getValue(2);
Does getValue exist in stock Torque, or do I need to go down the c++ route? Just don't want to over complicate things when functionality exists.
Thanks
Associate Rene Damm
There is "NextToken" but be aware that this function modifies the original string so this better not be a string table entry or other shared string. IMO this function shouldn't be there. Modifying strings in place is generally a bad idea.
If you can live with using standard delimiters (tab, space, newlines) it's the easiest thing to go with the standard Torque vector functions. You could have:
"ArrayObject::getValue" exists in stock Torque.