static lua_State *L = NULL;
+ static int
+lua_is_open(void)
+{
+ return L != NULL;
+}
+
static int
lua_init(void)
{
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);
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);