Surrexen Posted November 24, 2023 Posted November 24, 2023 (edited) If I have a string that contains horizontal tabs in it such as "Cats\t\tDogs" and print it out, it prints out with square symbols so the output looks like: Cats [] [] Dogs Is there a way to print out a string containing horizontal tabs without it outputting the symbols? If I do it in a regular lua compiler the output is fine. Thanks in advance Edited November 24, 2023 by Surrexen
cfrag Posted November 24, 2023 Posted November 24, 2023 3 hours ago, Surrexen said: Is there a way to print out a string containing horizontal tabs without it outputting the symbols? If the question is "how do I remove control characters from a string", i.e. merely get rid of the squares, the answer is easy: use gsub on the "%c" pattern: str = str:gsub('[%c]', ' ') above will replace all control characters (including linefeeds, backspaces, tab, etc) with a blank " ". Now, if the question is "how can we do tabs in outText()", I really don't know, I don't think it's designed with positioning of text.
Surrexen Posted November 24, 2023 Author Posted November 24, 2023 34 minutes ago, cfrag said: If the question is "how do I remove control characters from a string", i.e. merely get rid of the squares, the answer is easy: use gsub on the "%c" pattern: str = str:gsub('[%c]', ' ') above will replace all control characters (including linefeeds, backspaces, tab, etc) with a blank " ". Now, if the question is "how can we do tabs in outText()", I really don't know, I don't think it's designed with positioning of text. It's the latter. The real reason behind the question is trying to output table data and line up columns and rows more precisely. So yes I guess that's a better way of putting it, how do we do tabs in outText() without getting the squares to display.
cfrag Posted November 24, 2023 Posted November 24, 2023 55 minutes ago, Surrexen said: output table data and line up columns and rows more precisely I've tried that some time ago, but since the font that's used in DCS outText() isn't monospaced, and there is no way to position the insertion point, not even pre-processing the output will get you anywhere near a passable formatted table output. Or put different: my limited imagination currently fails, and I did think about off-screen image rendering per-column and then sending the result as imageToGroup.
Surrexen Posted November 24, 2023 Author Posted November 24, 2023 2 hours ago, cfrag said: I've tried that some time ago, but since the font that's used in DCS outText() isn't monospaced, and there is no way to position the insertion point, not even pre-processing the output will get you anywhere near a passable formatted table output. Or put different: my limited imagination currently fails, and I did think about off-screen image rendering per-column and then sending the result as imageToGroup. Oh well, I guess wonky donkey columns etc will have to do unless anyone else has some magic way of doing it. Thanks very much @cfrag for the responses.
Recommended Posts