lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, 28 Dec 2009 22:46:05 +0200, Rob Hoelz <> wrote:
I figured I'd just start simple, but feel free to optimize! =)

Well, since you say so... :)

bright = '\27[1m'
red = '\27[31m'
reset = '\27[m'
print(red, "text", reset)

more simple:
print "\27[1;31mBAD HAPPEN!\27[m"

Actually, most of the time writing escapes inline is much easier than using a library. And since Lua accepts control characters inside quotes, you actually can type ^[ character instead of \27 (when writing with e.g. vim or emacs) and then using "less -R" you can see your code in full color.