diff options
| author | 2025-02-11 14:38:35 -0500 | |
|---|---|---|
| committer | 2025-02-11 14:38:35 -0500 | |
| commit | a1cdb80a68ed8821c2ed9f22f520cc4e6df8a626 (patch) | |
| tree | ebe6869df98e954b9453f5d2c7b0f5aee18fa3a2 /src/lua_api.c | |
| parent | v0.3.0 (diff) | |
add api method to enable/disable inline suggestions
Diffstat (limited to 'src/lua_api.c')
| -rw-r--r-- | src/lua_api.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lua_api.c b/src/lua_api.c index e9473a0..ae5decf 100644 --- a/src/lua_api.c +++ b/src/lua_api.c @@ -32,6 +32,7 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // globals static bool debug_mode = false; +bool suggestion_enable = true; // -- script execution -- int lua_load_script(lua_State *L, const char *script, char **args) { @@ -175,6 +176,13 @@ static int l_get_cwd(lua_State *L) { return 1; } +static int l_suggestions(lua_State *L) { + if (lua_isboolean(L, 1)) { + suggestion_enable = lua_toboolean(L, 1); + } + return 0; +} + static int l_debug(lua_State *L) { if (lua_isboolean(L, 1)) { debug_mode = lua_toboolean(L, 1); @@ -426,6 +434,8 @@ void lua_register_api(lua_State *L) { lua_setfield(L, -2, "getcwd"); lua_pushcfunction(L, l_debug); lua_setfield(L, -2, "debug"); + lua_pushcfunction(L, l_suggestions); + lua_setfield(L, -2, "suggestions"); lua_pushcfunction(L, l_cd); lua_setfield(L, -2, "cd"); lua_pushcfunction(L, l_exists); |
