diff options
author | 2019-02-17 09:07:56 -0600 | |
---|---|---|
committer | 2019-02-17 09:07:56 -0600 | |
commit | 836abb0d63fc44fda201b76023612b1f5a21a8ac (patch) | |
tree | 19c3108559aeae9fae2e62bcece3ed5ab29459d7 /3rdparty/lua-linenoise | |
parent | 764f04c31727f1e377a6b8447a017f670ce22e8a (diff) |
plugins/console: command history (nw)
Diffstat (limited to '3rdparty/lua-linenoise')
-rw-r--r-- | 3rdparty/lua-linenoise/linenoise.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/3rdparty/lua-linenoise/linenoise.c b/3rdparty/lua-linenoise/linenoise.c index 768d455729d..aab7c1418ea 100644 --- a/3rdparty/lua-linenoise/linenoise.c +++ b/3rdparty/lua-linenoise/linenoise.c @@ -175,12 +175,26 @@ static int l_refresh(lua_State *L) return handle_ln_ok(L); } +static int l_historyget(lua_State *L) +{ + int len, i; + char **history = linenoiseHistory(&len); + lua_newtable(L); + for(i = 0; i < len; i++) + { + lua_pushstring(L, history[i]); + lua_rawseti(L, -2, i + 1); + } + return 1; +} + luaL_Reg linenoise_funcs[] = { { "linenoise", l_linenoise }, { "historyadd", l_historyadd }, { "historysetmaxlen", l_historysetmaxlen }, { "historysave", l_historysave }, { "historyload", l_historyload }, + { "historyget", l_historyget }, { "clearscreen", l_clearscreen }, { "setcompletion", l_setcompletion}, { "addcompletion", l_addcompletion }, |