コード例 #1
0
ファイル: if_lua.c プロジェクト: LeonB/vim
    static int
luaV_window_index(lua_State *L)
{
    win_T *w = (win_T *) luaV_checkvalid(L, luaV_Window, 1);
    const char *s = luaL_checkstring(L, 2);
    if (strncmp(s, "buffer", 6) == 0)
	luaV_pushbuffer(L, w->w_buffer);
    else if (strncmp(s, "line", 4) == 0)
	lua_pushinteger(L, w->w_cursor.lnum);
    else if (strncmp(s, "col", 3) == 0)
	lua_pushinteger(L, w->w_cursor.col + 1);
#ifdef FEAT_VERTSPLIT
    else if (strncmp(s, "width", 5) == 0)
	lua_pushinteger(L, W_WIDTH(w));
#endif
    else if (strncmp(s, "height", 6) == 0)
	lua_pushinteger(L, w->w_height);
    /* methods */
    else if (strncmp(s,   "next", 4) == 0
	    || strncmp(s, "previous", 8) == 0
	    || strncmp(s, "isvalid", 7) == 0)
    {
	lua_getmetatable(L, 1);
	lua_getfield(L, -1, s);
    }
    else
	lua_pushnil(L);
    return 1;
}
コード例 #2
0
ファイル: if_lua.c プロジェクト: GoogleChrome/collab-vim
static int
luaV_buffer_previous(lua_State *L)
{
    luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER);
    luaV_pushbuffer(L, (*b)->b_prev);
    return 1;
}
コード例 #3
0
ファイル: if_lua.c プロジェクト: LeonB/vim
    static int
luaV_buffer_previous(lua_State *L)
{
    luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER);
    buf_T *buf = (buf_T *) luaV_checkcache(L, (void *) *b);
    luaV_pushbuffer(L, buf->b_prev);
    return 1;
}