aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-09-19 14:24:09 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-09-19 14:24:09 +0200
commitc08420ef849400b347c18dd5dc0d5086f7eab18b (patch)
tree8a0a043d0f55d5ce1b6ec251f23b85b82f7673d4 /vis-lua.c
parent478b86451c7896b5dc7f18962975a42549686b8e (diff)
downloadvis-c08420ef849400b347c18dd5dc0d5086f7eab18b.tar.gz
vis-c08420ef849400b347c18dd5dc0d5086f7eab18b.tar.xz
vis-lua: expose file save event to lua
Triggered after the new file content has been written to disk.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 91ce414..56b86ae 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -1513,7 +1513,13 @@ void vis_lua_file_open(Vis *vis, File *file) {
}
void vis_lua_file_save(Vis *vis, File *file) {
-
+ lua_State *L = vis->lua;
+ vis_lua_event_get(L, "file_save");
+ if (lua_isfunction(L, -1)) {
+ obj_ref_new(L, file, "vis.file");
+ pcall(vis, L, 1, 0);
+ }
+ lua_pop(L, 1);
}
void vis_lua_file_close(Vis *vis, File *file) {