[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: What about using linenoise?
From: David Burgess <dabsoft () gmail ! com>
Date: 2010-03-29 22:35:30
Message-ID: 4BB12B32.1040402 () gmail ! com
[Download RAW message or body]
THanks for the info about linenoise. I have been using in
my current project and it work well. Its solves the problem
of porting to small machines.
DB
On 26/3/2010 3:05 PM, Luiz Henrique de Figueiredo wrote:
>> Would it make sense to eventually use linenoise instead of readline in Lua?
>
> luaconf already has macros for this.
> To use linenoise, I expect these should work:
>
> #if defined(LUA_USE_LINENOISE)
> #include "linenoise.h"
> #define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL)
> #define lua_saveline(L,idx) \
> if (lua_strlen(L,idx)> 0) /* non-empty line? */ \
> linenoiseHistoryAdd(lua_tostring(L, idx)); /* add it to history */
> #define lua_freeline(L,b) ((void)L, free(b))
> #endif
>
> Or you can just use this emulation of readline:
>
> #define readline linenoise
> #define add_history linenoiseHistoryAdd
>
> Of course, you need to add linenoise.o to your project.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic