lua-users home
lua-l archive

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


Hi,

John Belmonte wrote:
> > I've updated my patch for Lua 5.1. Here is the download link:
> >   http://luajit.luaforge.net/patches/lua-5.1-advanced-readline.patch
> 
> This is great, and I guess it would be nice to see it in Lua 5.2 as is,
> but I'm wondering if we can do something more general.  Would it be
> possible to make this a module?  Then we could reference it explicitly
> when invoking the interpreter (i.e. "lua -ladvanced_readline") or
> require it indirectly via LUA_INIT.  I'd like to open up possibilities
> for user customizations, implementing the advanced support in Lua itself
> (still via the readline library), and allowing Lua command lines other
> than that of lua.c to have identical capabilities.

I'd do it this way: add the C support for reading a line with
optional line editing into the io library as io.readline().
The portable fallback would be fgets().

This makes the functionality reusable for other Lua applications
(a simple debugger or a mud-like game) instead of burying it into
the Lua standalone executable.

Some things like the completion callback or history saving must
be overridable from the Lua side on a per-application basis. This
needs some further thought.

But I wonder ... how many of us command line addicts are left?
I'm not sure this will find many users ...

Bye,
     Mike