aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-23 11:44:11 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-23 11:44:11 +0200
commit436e2c1ff8ab8ac4f8bc4078312838c4fc5d226e (patch)
tree75f81894eeb9aca9d241e8172d0ceefb200a56fc /vis-lua.c
parentd6effd021d2aa2b6c452f229046a85c5f1a252a7 (diff)
downloadvis-436e2c1ff8ab8ac4f8bc4078312838c4fc5d226e.tar.gz
vis-436e2c1ff8ab8ac4f8bc4078312838c4fc5d226e.tar.xz
vis: display lua search paths in :help output
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c13
1 files changed, 12 insertions, 1 deletions
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)