diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-31 19:31:32 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-12-31 19:31:32 +0100 |
| commit | aff8ffe0646899d5bedf6a8d2d88fff257645c45 (patch) | |
| tree | 36ff31fa083c2624b466d3348521a6fe464d15b6 /vis-lua.c | |
| parent | a11d14b24b3322dddf03f5c6fb4f7d75165cd25c (diff) | |
| download | vis-aff8ffe0646899d5bedf6a8d2d88fff257645c45.tar.gz vis-aff8ffe0646899d5bedf6a8d2d88fff257645c45.tar.xz | |
vis: allow user registered :-commands to specify a help text
Diffstat (limited to 'vis-lua.c')
| -rw-r--r-- | vis-lua.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -903,6 +903,7 @@ static bool command_lua(Vis *vis, Win *win, void *data, bool force, const char * * @function command_register * @tparam string name the command name * @tparam function command the Lua function implementing the command + * @tparam[opt] string help the single line help text as displayed in `:help` * @treturn bool whether the command has been successfully registered * @usage * TODO @@ -911,7 +912,8 @@ static int command_register(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); const char *name = luaL_checkstring(L, 2); const void *func = func_ref_new(L, 3); - bool ret = vis_cmd_register(vis, name, (void*)func, command_lua); + const char *help = luaL_optstring(L, 4, ""); + bool ret = vis_cmd_register(vis, name, help, (void*)func, command_lua); lua_pushboolean(L, ret); return 1; } |
