aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-31 19:31:32 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-31 19:31:32 +0100
commitaff8ffe0646899d5bedf6a8d2d88fff257645c45 (patch)
tree36ff31fa083c2624b466d3348521a6fe464d15b6 /vis-lua.c
parenta11d14b24b3322dddf03f5c6fb4f7d75165cd25c (diff)
downloadvis-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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 5c8c46e..8925d24 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -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;
}