Advertisement

Missing '\t' tab constant management (v2.6.0)

Started by May 24, 2006 12:24 PM
1 comment, last by Deyja 18 years, 6 months ago
Hi, This is a tiny contribution to be able to write tabs using '\t' in string or character constants in scripts. Just go to as_compiler.cpp, in the ProcessStringConstant() method, line 4248 and adds the following two lines: else if( cstr[n] == 't' ) str.PushLast('\t'); So you get: ... else if( cstr[n] == 'r' ) str.PushLast('\r'); else if( cstr[n] == 't' ) str.PushLast('\t'); else if( cstr[n] == '0' ) str.PushLast('\0'); ... Notice I placed it between '\r' and '\0' but it could be added in other places. Then you'll be able to write in your scripts something like: ... string MyString = "\tThis text is tabbed.\n"; int tabChar = '\t'; ...
Lbas
Thanks, I'll add this to the script library.

It's odd that nobody complained about it before, as it is a rather common escape char, or perhaps not as common as I thought. :)

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Tab can be entered directly into the script, so the escape isn't totally neccessary. So no one complained because they just pressed tab instead.

This topic is closed to new replies.

Advertisement