lua: print in colour

This a short memo on how to print in colour in lua.

Codes:

  • Red: 31
  • Green: 32
  • Yellow: 33
  • Blue: 34

Example, print “hello” in red:

lua -e 'print(string.format("\27[%dm%s\27[0m", 31, "hello"))'