Question about Tabs

Posted by Maxhrk on Sun 15 Apr 2007 05:57 PM — 6 posts, 22,703 views.

USA #0
I try to find a way to make my helpfile look elegant or whatever you call it.. like with tab. example below:


HELP
----------------------------------

    1) Start
    ...
    00) Credits

----------------------------------



well i have read about <ESC>H is tab right? athough AnsiNote dont have it since i have look all over the document already. :)

any suggestion? thanks.
Amended on Sun 15 Apr 2007 05:59 PM by Maxhrk
Australia Forum Administrator #1
It is Ctrl+I (hex 0x09).

In Lua you could do it like this:


tab = string.char (9)
print (tab .. "hello" .. tab .. "world")

USA #2
ah string.char..


okay thanks you very much for help, Nick Gammon.
Australia Forum Administrator #3
If you are using Lua another approach is to look up string.format, and use fixed-width text fields.

For example:


print (string.format ("%-10s %-10s", "hello", "world"))

-->

hello      world


If you say %10s, then you have a string that takes at least 10 positions (more if it is wider), and the "-" makes it left-justified.
Australia Forum Administrator #4
Of course, a simpler way in Lua is to use the \t character. For example:


print ("hi \t there")

USA #5
thanks again, Nick.. Yeah I do use Lua, i think it is awesome anyway. :)