aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2024-05-21 10:23:25 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-05-21 20:21:46 -0600
commit7e85064ac77ea43e84d88eb910b0adb6f07d5d12 (patch)
tree60087cfc22d2e8c67b2d83a7202a8bbb2a5c1c1e /vis-lua.c
parent486e8631ce9269d34c00c07038e04013640f8825 (diff)
downloadvis-7e85064ac77ea43e84d88eb910b0adb6f07d5d12.tar.gz
vis-7e85064ac77ea43e84d88eb910b0adb6f07d5d12.tar.xz
remove some ui pointer chasing
There only exists a single Ui so there is no need to force a pointer redirection for accessing it. The Ui member was moved down in vis-core.h to punt around an issue with the way lua checks for existing objects. It may show up again as I flatten more structs.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 3b5f784..6bd8a08 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -1399,7 +1399,7 @@ static int vis_index(lua_State *L) {
}
if (strcmp(key, "registers") == 0) {
- obj_ref_new(L, vis->ui, VIS_LUA_TYPE_REGISTERS);
+ obj_ref_new(L, &vis->ui, VIS_LUA_TYPE_REGISTERS);
return 1;
}
@@ -1415,7 +1415,7 @@ static int vis_index(lua_State *L) {
}
if (strcmp(key, "ui") == 0) {
- obj_ref_new(L, vis->ui, VIS_LUA_TYPE_UI);
+ obj_ref_new(L, &vis->ui, VIS_LUA_TYPE_UI);
return 1;
}
}
@@ -1429,8 +1429,7 @@ static int vis_options_assign(Vis *vis, lua_State *L, const char *key, int next)
} else if (strcmp(key, "changecolors") == 0) {
vis->change_colors = lua_toboolean(L, next);
} else if (strcmp(key, "escdelay") == 0) {
- TermKey *tk = vis->ui->termkey;
- termkey_set_waittime(tk, luaL_checkint(L, next));
+ termkey_set_waittime(vis->ui.termkey, luaL_checkint(L, next));
} else if (strcmp(key, "ignorecase") == 0 || strcmp(key, "ic") == 0) {
vis->ignorecase = lua_toboolean(L, next);
} else if (strcmp(key, "loadmethod") == 0) {
@@ -1570,8 +1569,7 @@ static int vis_options_index(lua_State *L) {
lua_pushboolean(L, vis->change_colors);
return 1;
} else if (strcmp(key, "escdelay") == 0) {
- TermKey *tk = vis->ui->termkey;
- lua_pushunsigned(L, termkey_get_waittime(tk));
+ lua_pushunsigned(L, termkey_get_waittime(vis->ui.termkey));
return 1;
} else if (strcmp(key, "ignorecase") == 0 || strcmp(key, "ic") == 0) {
lua_pushboolean(L, vis->ignorecase);
@@ -3612,7 +3610,7 @@ static void vis_lua_ui_draw(Vis *vis) {
bool vis_event_emit(Vis *vis, enum VisEvents id, ...) {
if (!vis->initialized) {
vis->initialized = true;
- ui_init(vis->ui, vis);
+ ui_init(&vis->ui, vis);
vis_lua_init(vis);
}