diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-12-31 12:39:20 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-12-31 13:20:12 +0100 |
| commit | 92fef29765f2a2f3098bbd48ce534e50dcfe4d99 (patch) | |
| tree | f3f4dd115183ab9096f0e09bd9b11d6366ea6962 /vis-lua.c | |
| parent | 8424980892a3c25d3e2a79ac9ebe3e7eadfa0d6d (diff) | |
| download | vis-92fef29765f2a2f3098bbd48ce534e50dcfe4d99.tar.gz vis-92fef29765f2a2f3098bbd48ce534e50dcfe4d99.tar.xz | |
vis-lua: implement vis.events.{start,quit} events
Diffstat (limited to 'vis-lua.c')
| -rw-r--r-- | vis-lua.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -587,12 +587,21 @@ void vis_lua_start(Vis *vis) { lua_getglobal(L, "require"); lua_pushstring(L, "visrc"); lua_pcall(L, 1, 0, 0); + vis_lua_event(vis, "start"); + if (lua_isfunction(L, -1)) + lua_pcall(L, 0, 0, 0); + lua_pop(L, 1); } void vis_lua_quit(Vis *vis) { lua_State *L = vis->lua; - if (L) - lua_close(L); + if (!L) + return; + vis_lua_event(vis, "quit"); + if (lua_isfunction(L, -1)) + lua_pcall(L, 0, 0, 0); + lua_pop(L, 1); + lua_close(L); } void vis_lua_file_open(Vis *vis, File *file) { |
