aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-11-07 16:07:35 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-11-08 13:37:24 +0100
commitc407d30856f3a4af800cc2dd2f319be903381705 (patch)
tree2df05eca422299018eb30e016d43f3c76d4c563f /vis.c
parent96e0a52358247aa99242b786cd88bd310d1c5311 (diff)
downloadvis-c407d30856f3a4af800cc2dd2f319be903381705.tar.gz
vis-c407d30856f3a4af800cc2dd2f319be903381705.tar.xz
vis: introduce vis namespace for lua objects
For now the vis table has only one member "lexers".
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 12f3b19..dc56fb3 100644
--- a/vis.c
+++ b/vis.c
@@ -132,7 +132,8 @@ void vis_window_name(Win *win, const char *filename) {
}
if (filename && L) {
- lua_getglobal(L, "lexers");
+ lua_getglobal(L, "vis");
+ lua_getfield(L, -1, "lexers");
lua_getfield(L, -1, "lexer_name");
lua_pushstring(L, filename);
lua_pcall(L, 1, 1, 0);
@@ -360,7 +361,10 @@ Vis *vis_new(Ui *ui) {
lua_close(L);
vis->lua = L = NULL;
} else {
- lua_setglobal(L, "lexers");
+ lua_newtable(L); /* vis */
+ lua_pushvalue(L, -2); /* require return value */
+ lua_setfield(L, -2, "lexers");
+ lua_setglobal(L, "vis");
vis_theme_load(vis, "default");
}