aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-28 09:37:22 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-28 09:44:08 +0100
commitb759216c0ab22f03f8dbcdfbcaae9fa41d998949 (patch)
tree8776e91d66b3a708fa7cd8e96bb3f585a2f08e72
parent50b109c16ab362196900abc01a3dc60fbe0f86ef (diff)
downloadvis-b759216c0ab22f03f8dbcdfbcaae9fa41d998949.tar.gz
vis-b759216c0ab22f03f8dbcdfbcaae9fa41d998949.tar.xz
vis-lua: correctly treat return value of input event handler
Returning true from the event handler, indicating that the keys were consumed, should now prevent insertion as mentioned in the documentation. vis.events.subscribe(vis.events.INPUT, function(key) if key == ' ' then -- do something fancy here return true end end)
-rw-r--r--vis-lua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 0fdf225..17f0004 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -2439,7 +2439,7 @@ static bool vis_lua_input(Vis *vis, const char *key, size_t len) {
vis_lua_event_get(L, "input");
if (lua_isfunction(L, -1)) {
lua_pushlstring(L, key, len);
- if (pcall(vis, L, 1, 1) != 0) {
+ if (pcall(vis, L, 1, 1) == 0) {
ret = lua_isboolean(L, -1) && lua_toboolean(L, -1);
lua_pop(L, 1);
}