Simple bindings for linenoise.
Linenoise compiled as a shared library. (See https://github.com/enotodden/linenoise/Makefile for a makefile..)
local linenoise = require("linenoise")
local line
while true do
line = linenoise.linenoise(">>> ")
if line then
print("You said: " .. line)
else
break
end
end
More examples in the examples/
directory.
- Same function names and arguments as the linenoise C functions, but integer return values are converted to boolean.
linenoise.linenoise()
returnsnil
instead ofNULL
for convinience. (SinceNULL
is truthy)