Game Development Community

Add string comparison commands to TorqueScript Reference

by Minty Hunter · in Torque Game Builder · 02/14/2007 (12:21 pm) · 3 replies

The TorqueScript Reference is a nice collection of various operators, but the string ones are missing.

They _are_ in the full reference, but I had trouble finding them because I was looking for something like $> and $< (fairly logical given the $= string comparitor).

Suggestion: add strcmp(string1, string2) and stricmp(string1, string2) to the 'TorqueScript Reference.html'.

#1
02/14/2007 (5:06 pm)
@Minty, the TorqueScript reference only contains TorqueScript language semantics, such as operators and how for() and while() loops are built, etc;

The strcmp and stricmp functions are, just that, functions -- you still need to bundle those functions with operators from the reference -- which is why they were not added to the reference.
#2
02/14/2007 (6:27 pm)
@David: Okay, I can see that makes sense in a technical sense. I guess I'm just used to string comparitors looking similar to numeric ones, rather than being functions. But I'm more an AS/lingo/php/js geek, than a C+ one, so maybe there having these as functions is more common in other realms.

I can only point to what I did: went and looked in the list of comparison operators when I wanted to see how to compare strings, didn't find them and thought 'what a strange shortcoming'. I understand, however, this just might be my inexperience with more game-centric languages :)
#3
02/14/2007 (7:04 pm)
@Minty -- The TGB Reference contains a 'Console Functions' category, which contains a 'String' sub-category -- and very few languages allow you to do anything other then compare a string to another string for the purposes of equality -- comparing character literals is possible in most C-style languages where the 'char' type is actually a 'byte' which is in-fact a 'short short' (1-byte)

I do see how it may have been confusing, but at the same time, I don't agree with putting these functions in the language reference as they are not semantic.