This module implements a Read-Eval-Print loop with command line editing and pretty colorized output. It is based heavily on torch/trepl.
Colorized output is on if the output is to a terminal and off otherwise;
behavior can be changed by the value of the TORCH_COLOR
environment variable:
always
enables colorized output always (even when output is not to a terminal)never
disable colorized output altogether
Usage: to run the default REPL:
local repl = require('fb.repl')
repl.repl()
(from the command line, try luajit -e "require('fb.repl').repl()"
)
You may create additional REPLs that do not share state with the main REPL (if any) -- useful if your program needs to accept arbitrary Lua input and evaluate it:
local loop = repl.make_repl()
loop()