Game Development Community

torquescript strncmp functionality?

by Bryan Morgan · in Torque 3D Professional · 10/28/2009 (6:10 pm) · 6 replies

Is there any way to perform in torquescript the equivalent of strncmp? For anyone not familiar with the C function strncmp, it allows for comparing a set number of characters in a string instead of comparing the entire string with another string which appears to be the only thing torquescript is capable of. It would be easy enough to export strncmp to torquescript, but I am wondering if this functionality already exists and I just don't see it documented.

#1
10/28/2009 (6:46 pm)
Torquescript string functions:
http://tdn.garagegames.com/wiki/TorqueScript_Console_Functions_3

I think you would have to use the getsubstr function together with strcmp to get the functionality you ask for with pure torquescript.
#2
10/28/2009 (6:51 pm)
Interesting that none of those functions are in the T3D docs, and I've not bothered with TDN for a while because it's become such a mess of broken links. getsubstr and strcmp would do what I'm wanting, though I may add strncmp just so it can be done in one line, and probably less overhead.
#3
10/28/2009 (7:26 pm)
The T3D docs are quite cut down actually, guess they are in rework for the 1.0
Don't understand why the scripting docs were hit by that hammer though.
#4
10/28/2009 (7:30 pm)
well, to put it mildly, the T3D docs aren't all that :)

Note that the link is a good reference for most torquescript console functions, not only string manipulation.
#5
10/28/2009 (7:30 pm)
> I think you would have to use the getsubstr function together with strcmp

or just write a new console function..
#6
10/28/2009 (10:28 pm)
Quote:Don't understand why the scripting docs were hit by that hammer though.
The script and C++ reference docs will be back very soon and better than ever. Check Mitch's doc posts in the forums for details.