Ulysses
General => Developers Corner => Topic started by: Chironex on February 29, 2008, 05:05:47 PM
-
It's something that i learned from my favorite language, Pawn, and hopefully it works in Lua too.
This can be very useful for making a nice presentation in the console, i think about the command 'ulx help'.
You all know about %s, in a string format ?, Well, you can use for example %20s, which will insert empty spaces at the begining of the string. Like
local str = string.format("%20s\t%s", k, v)
Msg( str )
Supposing this is in a for loop, and k and v are strings, will output things like
hello blabla
anothercommand etc
I haven't tested for numbers but it should work too, aligned to the right i guess (in Pawn, strings are aligned to the left, numbers and floats to the right)
I think this can improve 'readability' (sorry don't know the english word) of the long help list.
PS: For floats, %4.1f should output something like that:
20.5
-12.8
2.4
100.7
It's something that i would like Garry to implement in the function util.TableToKeyValue, and others things like that, instead of tabs.
-
We use format (which is a direct port from sprintf (http://cplusplus.com/reference/clibrary/cstdio/sprintf.html)) all over our code. It is not possible to use it in help as we have it though, due to the limiting nature of the number of characters we can fit on a line.
-
:(
Shouldn't it be possible to wrap to next line after a certain character count? to create like:
¤ command - blablablablablabalbalbalbalab lbalablabla ablaba laba lab lab alab alb
blablabalbal lbalab albalba alba laba lba a.
¤ anotherone - blablablablablabalbalbalbalab lbalablabla ablaba laba lab lab alab alb
blablabalbal lbalab albalba alba laba lba a.
Sorry for blablating :)
-
Do you really want the output to be even longer than it already is? ;)