File src/lua/common.c changed (mode: 100644) (index dd7eaa701..c6f7152cf) |
... |
... |
set_opt(lua_State *lua, opt_t *opt) |
162 |
162 |
return 0; |
return 0; |
163 |
163 |
} |
} |
164 |
164 |
|
|
|
165 |
|
void |
|
166 |
|
push_str_array(lua_State *lua, char *array[], int len) |
|
167 |
|
{ |
|
168 |
|
int i; |
|
169 |
|
lua_newtable(lua); |
|
170 |
|
for(i = 0; i < len; ++i) |
|
171 |
|
{ |
|
172 |
|
lua_pushstring(lua, array[i]); |
|
173 |
|
lua_seti(lua, -2, i + 1); |
|
174 |
|
} |
|
175 |
|
} |
|
176 |
|
|
165 |
177 |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
166 |
178 |
/* vim: set cinoptions+=t0 : */ |
/* vim: set cinoptions+=t0 : */ |
File src/lua/common.h changed (mode: 100644) (index 545cbb91c..1b9391ac1) |
... |
... |
int get_opt(struct lua_State *lua, struct opt_t *opt); |
56 |
56 |
* always zero. */ |
* always zero. */ |
57 |
57 |
int set_opt(struct lua_State *lua, struct opt_t *opt); |
int set_opt(struct lua_State *lua, struct opt_t *opt); |
58 |
58 |
|
|
|
59 |
|
/* Creates an array of strings and leaves it on the top of the stack. */ |
|
60 |
|
void push_str_array(struct lua_State *lua, char *array[], int len); |
|
61 |
|
|
59 |
62 |
#endif /* VIFM__LUA__COMMON_H__ */ |
#endif /* VIFM__LUA__COMMON_H__ */ |
60 |
63 |
|
|
61 |
64 |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
File src/lua/vifm_cmds.c changed (mode: 100644) (index 76888c540..b746fdf66) |
... |
... |
static void parse_cmd_params(vlua_t *vlua, cmd_add_t *cmd); |
37 |
37 |
static int VLUA_API(cmds_command)(lua_State *lua); |
static int VLUA_API(cmds_command)(lua_State *lua); |
38 |
38 |
static int VLUA_API(cmds_delcommand)(lua_State *lua); |
static int VLUA_API(cmds_delcommand)(lua_State *lua); |
39 |
39 |
static int lua_cmd_handler(const cmd_info_t *cmd_info); |
static int lua_cmd_handler(const cmd_info_t *cmd_info); |
40 |
|
static void push_str_array(lua_State *lua, char *array[], int len); |
|
41 |
40 |
static int apply_completion(lua_State *lua, const char str[]); |
static int apply_completion(lua_State *lua, const char str[]); |
42 |
41 |
|
|
43 |
42 |
VLUA_DECLARE_SAFE(cmds_add); |
VLUA_DECLARE_SAFE(cmds_add); |
|
... |
... |
vifm_cmds_complete(lua_State *lua, const cmd_info_t *cmd_info, int arg_pos) |
244 |
243 |
return apply_completion(lua, cmd_info->args + arg_pos); |
return apply_completion(lua, cmd_info->args + arg_pos); |
245 |
244 |
} |
} |
246 |
245 |
|
|
247 |
|
/* Creates an array of strings and leaves it on the top of the stack. */ |
|
248 |
|
static void |
|
249 |
|
push_str_array(lua_State *lua, char *array[], int len) |
|
250 |
|
{ |
|
251 |
|
int i; |
|
252 |
|
lua_newtable(lua); |
|
253 |
|
for(i = 0; i < len; ++i) |
|
254 |
|
{ |
|
255 |
|
lua_pushstring(lua, array[i]); |
|
256 |
|
lua_seti(lua, -2, i + 1); |
|
257 |
|
} |
|
258 |
|
} |
|
259 |
|
|
|
260 |
246 |
/* Does stack cleanup for the caller (-2). Returns offset of completion |
/* Does stack cleanup for the caller (-2). Returns offset of completion |
261 |
247 |
* matches. */ |
* matches. */ |
262 |
248 |
static int |
static int |