lua-users home
lua-l archive

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


Mike Pall wrote:
> 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.

I think that providing a Lua binding to libreadline is a separate issue.
 Actually since the library uses globals instead of a context it seems
like a bag of worms.

I've confirmed that your advanced readline code can work as a Lua module
with a few modifications.  There's no reason to patch lua.c (although it
would still be nice to see it added upstream).  I'm considering adding
this module to the Debian Lua interpreter package.  Users can opt in
with "LUA_INIT=require('advanced_readline')".

By the way, I'd like to add a LUA_COMPLETION_EXCLUDE_KEYWORDS option.  I
don't use completion as much to save typing as to explore an unknown
namespace.  Lua's set of keywords is small and relatively constant, and
I'd rather it didn't clutter the completion list.

--John