summaryrefslogtreecommitdiff
path: root/src/if_lua.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-08-12 22:14:01 +0200
committerBram Moolenaar <Bram@vim.org>2010-08-12 22:14:01 +0200
commit2bd6a1b54225a49e1b446201c7143cc766a7cf19 (patch)
treeb3d667ae1051cabaeb6b5a028dc2e0ede78be919 /src/if_lua.c
parent0be992e3476ff9df8b7d565042432970f56d7b7e (diff)
downloadvim-git-2bd6a1b54225a49e1b446201c7143cc766a7cf19.tar.gz
Fix: Lua interface tried to load the library when closing a buffer or window.
Diffstat (limited to 'src/if_lua.c')
-rw-r--r--src/if_lua.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/if_lua.c b/src/if_lua.c
index 21f66e9bf..35ee3002c 100644
--- a/src/if_lua.c
+++ b/src/if_lua.c
@@ -1123,6 +1123,12 @@ luaV_setrange(lua_State *L, int line1, int line2)
static lua_State *L = NULL;
static int
+lua_is_open(void)
+{
+ return L != NULL;
+}
+
+ static int
lua_init(void)
{
if (L == NULL)
@@ -1240,7 +1246,7 @@ ex_luafile(exarg_T *eap)
void
lua_buffer_free(buf_T *buf)
{
- if (lua_init() == FAIL) return;
+ if (!lua_is_open()) return;
luaV_getfield(L, LUAVIM_FREE);
lua_pushlightuserdata(L, (void *) buf);
lua_call(L, 1, 0);
@@ -1250,7 +1256,7 @@ lua_buffer_free(buf_T *buf)
void
lua_window_free(win_T *win)
{
- if (lua_init() == FAIL) return;
+ if (!lua_is_open()) return;
luaV_getfield(L, LUAVIM_FREE);
lua_pushlightuserdata(L, (void *) win);
lua_call(L, 1, 0);