Enable ANSI sequences in windows terminal

  ansi, lua, terminal, windows

I stumbled upon an interesting issue
in Windows:


C:> lua
> print("x1b[95mMagentax1b[0m")
-[95mMagenta-[0m

But if I run os.execute() even with an empty command,
before it, it works as expected:

C:> lua
> os.system(""); print("x1b[95mMagentax1b[0m")
Magenta

(the last line is printed with Magenta color)

terminal screenshot

Why it happens, and how can I make ANSI codes work
without calling os.execute()?

Source: Windows Questions

LEAVE A COMMENT