kumquat-buildroot/package/lua/5.4.6/0011-linenoise.patch
Francois Perrad 603df32a0c package/lua: bump to version 5.4.6
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2023-05-16 20:53:11 +02:00

26 lines
765 B
Diff

Add support of linenoise (replace readline)
see discussion, http://lua-users.org/lists/lua-l/2010-03/msg00879.html
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Index: b/src/lua.c
===================================================================
--- a/src/lua.c
+++ b/src/lua.c
@@ -438,6 +438,14 @@
#define lua_saveline(L,line) ((void)L, add_history(line))
#define lua_freeline(L,b) ((void)L, free(b))
+#elif defined(LUA_USE_LINENOISE)
+
+#include <linenoise.h>
+#define lua_initreadline(L) ((void)L)
+#define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL)
+#define lua_saveline(L,line) ((void)L, linenoiseHistoryAdd(line))
+#define lua_freeline(L,b) ((void)L, free(b))
+
#else /* }{ */
#define lua_initreadline(L) ((void)L)