diff --git a/lua.c b/lua.c index 2e95c40b..ae783a0d 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.233 2018/02/06 15:32:36 roberto Exp roberto $ +** $Id: lua.c,v 1.234 2018/03/06 20:30:17 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -383,12 +383,15 @@ static int handle_luainit (lua_State *L) { #include #include +#define lua_initreadline(L) \ + ((void)L, rl_readline_name="lua", rl_inhibit_completion=1) #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) #define lua_saveline(L,line) ((void)L, add_history(line)) #define lua_freeline(L,b) ((void)L, free(b)) #else /* }{ */ +#define lua_initreadline(L) ((void)L) #define lua_readline(L,b,p) \ ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ @@ -539,6 +542,7 @@ static void doREPL (lua_State *L) { int status; const char *oldprogname = progname; progname = NULL; /* no 'progname' on errors in interactive mode */ + lua_initreadline(L); while ((status = loadline(L)) != -1) { if (status == LUA_OK) status = docall(L, 0, LUA_MULTRET);