diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-12-20 11:04:20 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-12-26 21:29:15 +0100 |
| commit | 13a95942b6e33033e4bbbe27cc8cafc98c6924a2 (patch) | |
| tree | 04acfeef0b83b4d6e08212948313242b57779f73 /main.c | |
| parent | 39e2b6f1b7a750af55ceeadab977354919d0ccf5 (diff) | |
| download | vis-13a95942b6e33033e4bbbe27cc8cafc98c6924a2.tar.gz vis-13a95942b6e33033e4bbbe27cc8cafc98c6924a2.tar.xz | |
vis: refactor Lua integration
Lua support can now be disabled at compile time using:
$ make CONFIG_LUA=0
This commit also adds an initial Lua API and provides a few
default hooks.
We now also require Lua >= 5.2 due to the uservalue constructs.
In principle the same functionality could be implemented using
function environments from Lua 5.1.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -6,6 +6,7 @@ #include "ui-curses.h" #include "vis.h" +#include "vis-lua.h" #include "text-util.h" #include "text-motions.h" #include "text-objects.h" @@ -1620,7 +1621,17 @@ static void signal_handler(int signum, siginfo_t *siginfo, void *context) { int main(int argc, char *argv[]) { - vis = vis_new(ui_curses_new()); + VisEvent event = { + .vis_start = vis_lua_start, + .vis_quit = vis_lua_quit, + .file_open = vis_lua_file_open, + .file_save = vis_lua_file_save, + .file_close = vis_lua_file_close, + .win_open = vis_lua_win_open, + .win_close = vis_lua_win_close, + }; + + vis = vis_new(ui_curses_new(), &event); if (!vis) return EXIT_FAILURE; |
