diff options
Diffstat (limited to 'vis-lua.c')
| -rw-r--r-- | vis-lua.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1385,6 +1385,10 @@ static int redraw(lua_State *L) { * Currently unconsumed keys in the input queue. * @tfield string input_queue */ +/*** + * Register name in use. + * @tfield string register + */ static int vis_index(lua_State *L) { Vis *vis = obj_ref_check(L, 1, "vis"); @@ -1422,6 +1426,12 @@ static int vis_index(lua_State *L) { return 1; } + if (strcmp(key, "register") == 0) { + char name = vis_register_to(vis, vis_register_used(vis)); + lua_pushlstring(L, &name, 1); + return 1; + } + if (strcmp(key, "registers") == 0) { obj_ref_new(L, vis->ui, VIS_LUA_TYPE_REGISTERS); return 1; @@ -1460,6 +1470,13 @@ static int vis_newindex(lua_State *L) { vis_window_focus(obj_ref_check(L, 3, VIS_LUA_TYPE_WINDOW)); return 0; } + + if (strcmp(key, "register") == 0) { + const char *name = luaL_checkstring(L, 3); + if (strlen(name) == 1) + vis_register(vis, vis_register_from(vis, name[0])); + return 0; + } } return newindex_common(L); } |
