From 436e2c1ff8ab8ac4f8bc4078312838c4fc5d226e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 23 Apr 2016 11:44:11 +0200 Subject: vis: display lua search paths in :help output --- vis-lua.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'vis-lua.c') diff --git a/vis-lua.c b/vis-lua.c index 9c17849..50d0596 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -17,6 +17,8 @@ #if !CONFIG_LUA +bool vis_lua_path_add(Vis *vis, const char *path) { return true; } +const char *vis_lua_paths_get(Vis *vis) { return NULL; } void vis_lua_init(Vis *vis) { } void vis_lua_start(Vis *vis) { } void vis_lua_quit(Vis *vis) { } @@ -1033,7 +1035,7 @@ static bool vis_lua_path_strip(Vis *vis) { return true; } -static bool vis_lua_path_add(Vis *vis, const char *path) { +bool vis_lua_path_add(Vis *vis, const char *path) { if (!path) return false; lua_State *L = vis->lua; @@ -1049,6 +1051,15 @@ static bool vis_lua_path_add(Vis *vis, const char *path) { return true; } +const char *vis_lua_paths_get(Vis *vis) { + lua_State *L = vis->lua; + if (!L) + return NULL; + lua_getglobal(L, "package"); + lua_getfield(L, -1, "path"); + return lua_tostring(L, -1); +} + void vis_lua_init(Vis *vis) { lua_State *L = luaL_newstate(); if (!L) -- cgit v1.2.3