aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 56949fe..91ce414 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -1503,6 +1503,13 @@ void vis_lua_quit(Vis *vis) {
void vis_lua_file_open(Vis *vis, File *file) {
debug("event: file-open: %s %p %p\n", file->name ? file->name : "unnamed", (void*)file, (void*)file->text);
+ lua_State *L = vis->lua;
+ vis_lua_event_get(L, "file_open");
+ 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_save(Vis *vis, File *file) {