aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-21 22:33:18 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-21 22:34:03 +0200
commitd815268ee4c64a5c6134ee43968d0685eaac4d73 (patch)
tree679953ae3c612ceebb26fe5cfa7729bf4c2dd668 /vis-lua.c
parente76ec27418c4bf7599ce9ecc93ea1227fbc2db57 (diff)
downloadvis-d815268ee4c64a5c6134ee43968d0685eaac4d73.tar.gz
vis-d815268ee4c64a5c6134ee43968d0685eaac4d73.tar.xz
vis-lua: implement vis:message(msg)
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/vis-lua.c b/vis-lua.c
index d2a6bf0..a17ef3d 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -334,13 +334,22 @@ static int command(lua_State *L) {
static int info(lua_State *L) {
Vis *vis = obj_ref_check(L, 1, "vis");
- if (!vis) {
- lua_pushnil(L);
- return 1;
+ if (vis) {
+ const char *msg = luaL_checkstring(L, 2);
+ vis_info_show(vis, "%s", msg);
}
- const char *msg = luaL_checkstring(L, 2);
- vis_info_show(vis, "%s", msg);
- return 0;
+ lua_pushboolean(L, vis != NULL);
+ return 1;
+}
+
+static int message(lua_State *L) {
+ Vis *vis = obj_ref_check(L, 1, "vis");
+ if (vis) {
+ const char *msg = luaL_checkstring(L, 2);
+ vis_message_show(vis, msg);
+ }
+ lua_pushboolean(L, vis != NULL);
+ return 1;
}
static int open(lua_State *L) {
@@ -564,6 +573,7 @@ static const struct luaL_Reg vis_lua[] = {
{ "windows", windows },
{ "command", command },
{ "info", info },
+ { "message", message },
{ "open", open },
{ "map", map },
{ "motion", motion },