0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

Fix: Lua interface tried to load the library when closing a buffer or window.

This commit is contained in:
Bram Moolenaar 2010-08-12 22:14:01 +02:00
parent 0be992e347
commit 2bd6a1b542

View File

@ -1122,6 +1122,12 @@ luaV_setrange(lua_State *L, int line1, int line2)
static lua_State *L = NULL; static lua_State *L = NULL;
static int
lua_is_open(void)
{
return L != NULL;
}
static int static int
lua_init(void) lua_init(void)
{ {
@ -1240,7 +1246,7 @@ ex_luafile(exarg_T *eap)
void void
lua_buffer_free(buf_T *buf) lua_buffer_free(buf_T *buf)
{ {
if (lua_init() == FAIL) return; if (!lua_is_open()) return;
luaV_getfield(L, LUAVIM_FREE); luaV_getfield(L, LUAVIM_FREE);
lua_pushlightuserdata(L, (void *) buf); lua_pushlightuserdata(L, (void *) buf);
lua_call(L, 1, 0); lua_call(L, 1, 0);
@ -1250,7 +1256,7 @@ lua_buffer_free(buf_T *buf)
void void
lua_window_free(win_T *win) lua_window_free(win_T *win)
{ {
if (lua_init() == FAIL) return; if (!lua_is_open()) return;
luaV_getfield(L, LUAVIM_FREE); luaV_getfield(L, LUAVIM_FREE);
lua_pushlightuserdata(L, (void *) win); lua_pushlightuserdata(L, (void *) win);
lua_call(L, 1, 0); lua_call(L, 1, 0);