Ok, lets look at what we know:
getstring is the default AutoCAD, i.e. not overwritten by a custom routine
T is indeed True
getstring returns correctly when value is not a number
getstring interprets spaces correctly
code is NOT part of a larger project (or is it)
S is not a global variable to another program (or is it)
Everything tells me that this should be operating as it is supposed to, and my gut instinct tells me that there is something amis, if you can indeed type the code at the command line and it works fine, but cannot load it through the IDE and have it work properly.
All sources of error have been eliminated so far as I can tell, so we must look at the other aspects, i.e. such as YOUR copy of the code you are trying to get to work from the IDE.