vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit b3de87f0bb86e6494eaa2e78c9fdf69286952067 parent 81828e983e4fbe26b2236d5820a01653c1667704 Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 17 Feb 2016 14:56:07 +0100 vis-lua: expose vis_motion to lua Diffstat:
| M | vis-lua.c | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/vis-lua.c b/vis-lua.c @@ -366,6 +366,14 @@ err: return 1; } +static int motion(lua_State *L) { + Vis *vis = obj_ref_check(L, 1, "vis"); + enum VisMotion id = luaL_checkunsigned(L, 2); + // TODO handle var args? + lua_pushboolean(L, vis && vis_motion(vis, id)); + return 1; +} + static int vis_index(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); if (!vis) { @@ -428,6 +436,7 @@ static const struct luaL_Reg vis_lua[] = { { "info", info }, { "open", open }, { "map", map }, + { "motion", motion }, { "__index", vis_index }, { "__newindex", vis_newindex }, { NULL, NULL },