master hovercats/oakiss / pkg / vis / patch / 0002-support-lua-5.5.patch
  1From ca925be7690b0f895a03487d2c2288ba88968441 Mon Sep 17 00:00:00 2001
  2From: Christian Hesse <mail@eworm.de>
  3Date: Mon, 5 Jan 2026 15:01:19 +0100
  4Subject: [PATCH] support lua 5.5...
  5
  6... and replace the functions for unsigned integers with their
  7signed equivalents, using a type cast where needed.
  8
  9Actually the functions for unsigned integers were deprecated since
 10lua 5.3...
 11
 12https://www.lua.org/manual/5.3/manual.html#8.3
 13
 14Also lua_newstate() requires a third argument since 5.5...
 15
 16https://www.lua.org/manual/5.5/manual.html#8.3
 17
 18Finally the key in a for loop is now const, so use a temporary
 19variable instead.
 20---
 21 configure            |   4 +-
 22 lua/lexers/lexer.lua |   2 +-
 23 vis-lua.c            | 117 ++++++++++++++++++++++---------------------
 24 3 files changed, 64 insertions(+), 59 deletions(-)
 25
 26diff --git a/configure b/configure
 27index dced540a..54f5a42b 100755
 28--- a/configure
 29+++ b/configure
 30@@ -444,7 +444,7 @@ int main(int argc, char *argv[]) {
 31 }
 32 EOF
 33 
 34-	for liblua in lua lua5.4 lua5.3 lua5.2 lua-5.4 lua-5.3 lua-5.2 lua54 lua53 lua52; do
 35+	for liblua in lua lua5.5 lua5.4 lua5.3 lua5.2 lua-5.5 lua-5.4 lua-5.3 lua-5.2 lua55 lua54 lua53 lua52; do
 36 		printf " checking for %s... " "$liblua"
 37 
 38 		if test "$have_pkgconfig" = "yes" ; then
 39@@ -505,7 +505,7 @@ int main(int argc, char *argv[]) {
 40 }
 41 EOF
 42 
 43-	for liblpeg in lpeg lua5.4-lpeg lua5.3-lpeg lua5.2-lpeg; do
 44+	for liblpeg in lpeg lua5.5-lpeg lua5.4-lpeg lua5.3-lpeg lua5.2-lpeg; do
 45 		printf " checking for static %s... " "$liblpeg"
 46 
 47 		if test "$have_pkgconfig" = "yes" ; then
 48diff --git a/lua/lexers/lexer.lua b/lua/lexers/lexer.lua
 49index f860d668..51c3b4b8 100644
 50--- a/lua/lexers/lexer.lua
 51+++ b/lua/lexers/lexer.lua
 52@@ -1015,7 +1015,7 @@ function M.embed(lexer, child, start_rule, end_rule)
 53   if child._WORDLISTS then
 54     for name, i in pairs(child._WORDLISTS) do
 55       if type(name) == 'string' and type(i) == 'number' then
 56-        name = child._name .. '.' .. name
 57+        local tname = child._name .. '.' .. name
 58         lexer:word_match(name) -- for side effects
 59         lexer:set_word_list(name, child._WORDLISTS[i])
 60       end
 61diff --git a/vis-lua.c b/vis-lua.c
 62index a62daf89..26d3dc45 100644
 63--- a/vis-lua.c
 64+++ b/vis-lua.c
 65@@ -496,7 +496,7 @@ static int newindex_common(lua_State *L) {
 66 }
 67 
 68 static size_t getpos(lua_State *L, int narg) {
 69-	return lua_tounsigned(L, narg);
 70+	return (size_t)lua_tointeger(L, narg);
 71 }
 72 
 73 static size_t checkpos(lua_State *L, int narg) {
 74@@ -514,7 +514,7 @@ static void pushpos(lua_State *L, size_t pos) {
 75 	if (pos == EPOS)
 76 		lua_pushnil(L);
 77 	else
 78-		lua_pushunsigned(L, pos);
 79+		lua_pushinteger(L, pos);
 80 }
 81 
 82 static void pushrange(lua_State *L, Filerange *r) {
 83@@ -524,10 +524,10 @@ static void pushrange(lua_State *L, Filerange *r) {
 84 	}
 85 	lua_createtable(L, 0, 2);
 86 	lua_pushstring(L, "start");
 87-	lua_pushunsigned(L, r->start);
 88+	lua_pushinteger(L, r->start);
 89 	lua_settable(L, -3);
 90 	lua_pushstring(L, "finish");
 91-	lua_pushunsigned(L, r->end);
 92+	lua_pushinteger(L, r->end);
 93 	lua_settable(L, -3);
 94 }
 95 
 96@@ -816,7 +816,7 @@ err:
 97 }
 98 
 99 static int keymap(lua_State *L, Vis *vis, Win *win) {
100-	int mode = luaL_checkint(L, 2);
101+	int mode = luaL_checkinteger(L, 2);
102 	const char *key = luaL_checkstring(L, 3);
103 	const char *help = luaL_optstring(L, 5, NULL);
104 	KeyBinding *binding = vis_binding_new(vis);
105@@ -922,7 +922,7 @@ static int map(lua_State *L) {
106  * @see Window:unmap
107  */
108 static int keyunmap(lua_State *L, Vis *vis, Win *win) {
109-	enum VisMode mode = luaL_checkint(L, 2);
110+	enum VisMode mode = luaL_checkinteger(L, 2);
111 	const char *key = luaL_checkstring(L, 3);
112 	bool ret;
113 	if (!win)
114@@ -968,7 +968,7 @@ static bool binding_collect(const char *key, void *value, void *ctx) {
115 static int mappings(lua_State *L) {
116 	Vis *vis = obj_ref_check(L, 1, "vis");
117 	lua_newtable(L);
118-	for (Mode *mode = mode_get(vis, luaL_checkint(L, 2)); mode; mode = mode->parent) {
119+	for (Mode *mode = mode_get(vis, luaL_checkinteger(L, 2)); mode; mode = mode->parent) {
120 		if (!mode->bindings)
121 			continue;
122 		map_iterate(mode->bindings, binding_collect, vis->lua);
123@@ -986,7 +986,7 @@ static int mappings(lua_State *L) {
124  */
125 static int motion(lua_State *L) {
126 	Vis *vis = obj_ref_check(L, 1, "vis");
127-	enum VisMotion id = luaL_checkunsigned(L, 2);
128+	enum VisMotion id = luaL_checkinteger(L, 2);
129 	// TODO handle var args?
130 	lua_pushboolean(L, vis && vis_motion(vis, id));
131 	return 1;
132@@ -997,7 +997,7 @@ static size_t motion_lua(Vis *vis, Win *win, void *data, size_t pos) {
133 	if (!L || !func_ref_get(L, data) || !obj_ref_new(L, win, VIS_LUA_TYPE_WINDOW))
134 		return EPOS;
135 
136-	lua_pushunsigned(L, pos);
137+	lua_pushinteger(L, pos);
138 	if (pcall(vis, L, 2, 1) != 0)
139 		return EPOS;
140 	return getpos(L, -1);
141@@ -1035,7 +1035,7 @@ static int motion_register(lua_State *L) {
142  */
143 static int operator(lua_State *L) {
144 	Vis *vis = obj_ref_check(L, 1, "vis");
145-	enum VisOperator id = luaL_checkunsigned(L, 2);
146+	enum VisOperator id = luaL_checkinteger(L, 2);
147 	// TODO handle var args?
148 	lua_pushboolean(L, vis && vis_operator(vis, id));
149 	return 1;
150@@ -1094,7 +1094,7 @@ static int operator_register(lua_State *L) {
151  */
152 static int textobject(lua_State *L) {
153 	Vis *vis = obj_ref_check(L, 1, "vis");
154-	enum VisTextObject id = luaL_checkunsigned(L, 2);
155+	enum VisTextObject id = luaL_checkinteger(L, 2);
156 	lua_pushboolean(L, vis_textobject(vis, id));
157 	return 1;
158 }
159@@ -1103,7 +1103,7 @@ static Filerange textobject_lua(Vis *vis, Win *win, void *data, size_t pos) {
160 	lua_State *L = vis->lua;
161 	if (!L || !func_ref_get(L, data) || !obj_ref_new(L, win, VIS_LUA_TYPE_WINDOW))
162 		return text_range_empty();
163-	lua_pushunsigned(L, pos);
164+	lua_pushinteger(L, pos);
165 	if (pcall(vis, L, 2, 2) != 0 || lua_isnil(L, -1))
166 		return text_range_empty();
167 	return text_range_new(getpos(L, -2), getpos(L, -1));
168@@ -1205,7 +1205,7 @@ static bool command_lua(Vis *vis, Win *win, void *data, bool force, const char *
169 		return false;
170 	lua_newtable(L);
171 	for (size_t i = 0; argv[i]; i++) {
172-		lua_pushunsigned(L, i);
173+		lua_pushinteger(L, i);
174 		lua_pushstring(L, argv[i]);
175 		lua_settable(L, -3);
176 	}
177@@ -1320,7 +1320,7 @@ static int replace(lua_State *L) {
178  */
179 static int exit_func(lua_State *L) {
180 	Vis *vis = obj_ref_check(L, 1, "vis");
181-	int code = luaL_checkint(L, 2);
182+	int code = luaL_checkinteger(L, 2);
183 	vis_exit(vis, code);
184 	return 0;
185 }
186@@ -1475,7 +1475,7 @@ static int vis_index(lua_State *L) {
187 		}
188 
189 		if (strcmp(key, "mode") == 0) {
190-			lua_pushunsigned(L, vis->mode->id);
191+			lua_pushinteger(L, vis->mode->id);
192 			return 1;
193 		}
194 
195@@ -1494,7 +1494,7 @@ static int vis_index(lua_State *L) {
196 			if (count == VIS_COUNT_UNKNOWN)
197 				lua_pushnil(L);
198 			else
199-				lua_pushunsigned(L, count);
200+				lua_pushinteger(L, count);
201 			return 1;
202 		}
203 
204@@ -1536,7 +1536,7 @@ static int vis_options_assign(Vis *vis, lua_State *L, const char *key, int next)
205 		vis->change_colors = lua_toboolean(L, next);
206 	} else if (strcmp(key, "escdelay") == 0) {
207 		TermKey *tk = vis->ui->termkey_get(vis->ui);
208-		termkey_set_waittime(tk, luaL_checkint(L, next));
209+		termkey_set_waittime(tk, luaL_checkinteger(L, next));
210 	} else if (strcmp(key, "ignorecase") == 0 || strcmp(key, "ic") == 0) {
211 		vis->ignorecase = lua_toboolean(L, next);
212 	} else if (strcmp(key, "loadmethod") == 0) {
213@@ -1562,7 +1562,7 @@ static int vis_newindex(lua_State *L) {
214 	if (lua_isstring(L, 2)) {
215 		const char *key = lua_tostring(L, 2);
216 		if (strcmp(key, "mode") == 0) {
217-			enum VisMode mode = luaL_checkunsigned(L, 3);
218+			enum VisMode mode = luaL_checkinteger(L, 3);
219 			vis_mode_switch(vis, mode);
220 			return 0;
221 		}
222@@ -1572,7 +1572,7 @@ static int vis_newindex(lua_State *L) {
223 			if (lua_isnil(L, 3))
224 				count = VIS_COUNT_UNKNOWN;
225 			else
226-				count = luaL_checkunsigned(L, 3);
227+				count = luaL_checkinteger(L, 3);
228 			vis_count_set(vis, count);
229 			return 0;
230 		}
231@@ -1677,7 +1677,7 @@ static int vis_options_index(lua_State *L) {
232 			return 1;
233 		} else if (strcmp(key, "escdelay") == 0) {
234 			TermKey *tk = vis->ui->termkey_get(vis->ui);
235-			lua_pushunsigned(L, termkey_get_waittime(tk));
236+			lua_pushinteger(L, termkey_get_waittime(tk));
237 			return 1;
238 		} else if (strcmp(key, "ignorecase") == 0 || strcmp(key, "ic") == 0) {
239 			lua_pushboolean(L, vis->ignorecase);
240@@ -1739,7 +1739,7 @@ static int ui_index(lua_State *L) {
241 		const char *key  = lua_tostring(L, 2);
242 
243 		if (strcmp(key, "layout") == 0) {
244-			lua_pushunsigned(L, ui_layout_get(ui));
245+			lua_pushinteger(L, ui_layout_get(ui));
246 			return 1;
247 		}
248 	}
249@@ -1754,7 +1754,7 @@ static int ui_newindex(lua_State *L) {
250 		const char *key  = lua_tostring(L, 2);
251 
252 		if (strcmp(key, "layout") == 0) {
253-			ui->arrange(ui, luaL_checkint(L, 3));
254+			ui->arrange(ui, luaL_checkinteger(L, 3));
255 			return 0;
256 		}
257 	}
258@@ -1779,7 +1779,7 @@ static int registers_index(lua_State *L) {
259 	Array data = vis_register_get(vis, reg);
260 	for (size_t i = 0, len = array_length(&data); i < len; i++) {
261 		TextString *string = array_get(&data, i);
262-		lua_pushunsigned(L, i+1);
263+		lua_pushinteger(L, i+1);
264 		lua_pushlstring(L, string->data, string->len);
265 		lua_settable(L, -3);
266 	}
267@@ -1813,7 +1813,7 @@ static int registers_newindex(lua_State *L) {
268 
269 static int registers_len(lua_State *L) {
270 	Vis *vis = lua_touserdata(L, lua_upvalueindex(1));
271-	lua_pushunsigned(L, LENGTH(vis->registers));
272+	lua_pushinteger(L, LENGTH(vis->registers));
273 	return 1;
274 }
275 
276@@ -1885,21 +1885,21 @@ static int window_index(lua_State *L) {
277 			pushrange(L, &l);
278 			lua_settable(L, -3);
279 			lua_pushstring(L, "width");
280-			lua_pushunsigned(L, view_width_get(win->view));
281+			lua_pushinteger(L, view_width_get(win->view));
282 			lua_settable(L, -3);
283 			lua_pushstring(L, "height");
284-			lua_pushunsigned(L, view_height_get(win->view));
285+			lua_pushinteger(L, view_height_get(win->view));
286 			lua_settable(L, -3);
287 			return 1;
288 		}
289 
290 		if (strcmp(key, "width") == 0) {
291-			lua_pushunsigned(L, vis_window_width_get(win));
292+			lua_pushinteger(L, vis_window_width_get(win));
293 			return 1;
294 		}
295 
296 		if (strcmp(key, "height") == 0) {
297-			lua_pushunsigned(L, vis_window_height_get(win));
298+			lua_pushinteger(L, vis_window_height_get(win));
299 			return 1;
300 		}
301 
302@@ -1938,7 +1938,7 @@ static int window_options_assign(Win *win, lua_State *L, const char *key, int ne
303 		if (lua_isstring(L, next))
304 			view_breakat_set(win->view, lua_tostring(L, next));
305 	} else if (strcmp(key, "colorcolumn") == 0 || strcmp(key, "cc") == 0) {
306-		view_colorcolumn_set(win->view, luaL_checkint(L, next));
307+		view_colorcolumn_set(win->view, luaL_checkinteger(L, next));
308 	} else if (strcmp(key, "cursorline") == 0 || strcmp(key, "cul") == 0) {
309 		if (lua_toboolean(L, next))
310 			flags |= UI_OPTION_CURSOR_LINE;
311@@ -1988,9 +1988,9 @@ static int window_options_assign(Win *win, lua_State *L, const char *key, int ne
312 			flags &= ~UI_OPTION_STATUSBAR;
313 		view_options_set(win->view, flags);
314 	} else if (strcmp(key, "wrapcolumn") == 0 || strcmp(key, "wc") == 0) {
315-		view_wrapcolumn_set(win->view, luaL_checkint(L, next));
316+		view_wrapcolumn_set(win->view, luaL_checkinteger(L, next));
317 	} else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) {
318-		view_tabwidth_set(win->view, luaL_checkint(L, next));
319+		view_tabwidth_set(win->view, luaL_checkinteger(L, next));
320 	} else if (strcmp(key, "expandtab") == 0 || strcmp(key, "et") == 0) {
321 		win->expandtab = lua_toboolean(L, next);
322 	}
323@@ -2086,7 +2086,7 @@ static int window_unmap(lua_State *L) {
324  */
325 static int window_style_define(lua_State *L) {
326 	Win *win = obj_ref_check(L, 1, VIS_LUA_TYPE_WINDOW);
327-	enum UiStyle id = luaL_checkunsigned(L, 2);
328+	enum UiStyle id = luaL_checkinteger(L, 2);
329 	const char *style = luaL_checkstring(L, 3);
330 	bool ret = view_style_define(win->view, id, style);
331 	lua_pushboolean(L, ret);
332@@ -2107,7 +2107,7 @@ static int window_style_define(lua_State *L) {
333  */
334 static int window_style(lua_State *L) {
335 	Win *win = obj_ref_check(L, 1, VIS_LUA_TYPE_WINDOW);
336-	enum UiStyle style = luaL_checkunsigned(L, 2);
337+	enum UiStyle style = luaL_checkinteger(L, 2);
338 	size_t start = checkpos(L, 3);
339 	size_t end = checkpos(L, 4);
340 	view_style(win->view, style, start, end);
341@@ -2132,7 +2132,7 @@ static int window_style(lua_State *L) {
342  */
343 static int window_style_pos(lua_State *L) {
344 	Win *win = obj_ref_check(L, 1, VIS_LUA_TYPE_WINDOW);
345-	enum UiStyle style = luaL_checkunsigned(L, 2);
346+	enum UiStyle style = luaL_checkinteger(L, 2);
347 	size_t x = checkpos(L, 3);
348 	size_t y = checkpos(L, 4);
349 	bool ret = win->ui->style_set_pos(win->ui, (int)x, (int)y, style);
350@@ -2245,7 +2245,7 @@ static int window_options_index(lua_State *L) {
351 			lua_pushstring(L, view_breakat_get(win->view));
352 			return 1;
353 		} else if (strcmp(key, "colorcolumn") == 0 || strcmp(key, "cc") == 0) {
354-			lua_pushunsigned(L, view_colorcolumn_get(win->view));
355+			lua_pushinteger(L, view_colorcolumn_get(win->view));
356 			return 1;
357 		} else if (strcmp(key, "cursorline") == 0 || strcmp(key, "cul") == 0) {
358 			lua_pushboolean(L, view_options_get(win->view) & UI_OPTION_CURSOR_LINE);
359@@ -2278,7 +2278,7 @@ static int window_options_index(lua_State *L) {
360 			lua_pushinteger(L, view_tabwidth_get(win->view));
361 			return 1;
362 		} else if (strcmp(key, "wrapcolumn") == 0 || strcmp(key, "wc") == 0) {
363-			lua_pushunsigned(L, view_wrapcolumn_get(win->view));
364+			lua_pushinteger(L, view_wrapcolumn_get(win->view));
365 			return 1;
366 		}
367 	}
368@@ -2302,7 +2302,7 @@ static const struct luaL_Reg window_option_funcs[] = {
369 
370 static int window_selections_index(lua_State *L) {
371 	View *view = obj_ref_check(L, 1, VIS_LUA_TYPE_SELECTIONS);
372-	size_t index = luaL_checkunsigned(L, 2);
373+	size_t index = luaL_checkinteger(L, 2);
374 	size_t count = view_selections_count(view);
375 	if (index == 0 || index > count)
376 		goto err;
377@@ -2319,7 +2319,7 @@ err:
378 
379 static int window_selections_len(lua_State *L) {
380 	View *view = obj_ref_check(L, 1, VIS_LUA_TYPE_SELECTIONS);
381-	lua_pushunsigned(L, view_selections_count(view));
382+	lua_pushinteger(L, view_selections_count(view));
383 	return 1;
384 }
385 
386@@ -2442,17 +2442,17 @@ static int window_selection_index(lua_State *L) {
387 		}
388 
389 		if (strcmp(key, "line") == 0) {
390-			lua_pushunsigned(L, view_cursors_line(sel));
391+			lua_pushinteger(L, view_cursors_line(sel));
392 			return 1;
393 		}
394 
395 		if (strcmp(key, "col") == 0) {
396-			lua_pushunsigned(L, view_cursors_col(sel));
397+			lua_pushinteger(L, view_cursors_col(sel));
398 			return 1;
399 		}
400 
401 		if (strcmp(key, "number") == 0) {
402-			lua_pushunsigned(L, view_selections_number(sel)+1);
403+			lua_pushinteger(L, view_selections_number(sel)+1);
404 			return 1;
405 		}
406 
407@@ -2601,7 +2601,7 @@ static int file_index(lua_State *L) {
408 		}
409 
410 		if (strcmp(key, "size") == 0) {
411-			lua_pushunsigned(L, text_size(file->text));
412+			lua_pushinteger(L, text_size(file->text));
413 			return 1;
414 		}
415 
416@@ -2612,7 +2612,7 @@ static int file_index(lua_State *L) {
417 
418 		if (strcmp(key, "permission") == 0) {
419 			struct stat stat = text_stat(file->text);
420-			lua_pushunsigned(L, stat.st_mode & 0777);
421+			lua_pushinteger(L, stat.st_mode & 0777);
422 			return 1;
423 		}
424 
425@@ -2723,7 +2723,7 @@ static int file_delete(lua_State *L) {
426 static int file_lines_iterator_it(lua_State *L);
427 static int file_lines_iterator(lua_State *L) {
428 	File *file = obj_ref_check(L, 1, VIS_LUA_TYPE_FILE);
429-	size_t line = luaL_optunsigned(L, 2, 1);
430+	size_t line = luaL_optinteger(L, 2, 1);
431 	size_t *pos = lua_newuserdata(L, sizeof *pos);
432 	*pos = text_pos_by_lineno(file->text, line);
433 	lua_pushcclosure(L, file_lines_iterator_it, 2);
434@@ -2812,7 +2812,7 @@ static int file_mark_get(lua_State *L) {
435 	if (pos == EPOS)
436 		lua_pushnil(L);
437 	else
438-		lua_pushunsigned(L, pos);
439+		lua_pushinteger(L, pos);
440 	return 1;
441 }
442 
443@@ -2860,7 +2860,7 @@ static const struct luaL_Reg file_funcs[] = {
444 
445 static int file_lines_index(lua_State *L) {
446 	Text *txt = obj_ref_check(L, 1, VIS_LUA_TYPE_TEXT);
447-	size_t line = luaL_checkunsigned(L, 2);
448+	size_t line = luaL_checkinteger(L, 2);
449 	size_t start = text_pos_by_lineno(txt, line);
450 	size_t end = text_line_end(txt, start);
451 	if (start != EPOS && end != EPOS) {
452@@ -2879,7 +2879,7 @@ err:
453 
454 static int file_lines_newindex(lua_State *L) {
455 	Text *txt = obj_ref_check(L, 1, VIS_LUA_TYPE_TEXT);
456-	size_t line = luaL_checkunsigned(L, 2);
457+	size_t line = luaL_checkinteger(L, 2);
458 	size_t size;
459 	const char *data = luaL_checklstring(L, 3, &size);
460 	if (line == 0) {
461@@ -2907,7 +2907,7 @@ static int file_lines_len(lua_State *L) {
462 		lines = text_lineno_by_pos(txt, size);
463 	if (lines > 1 && text_byte_get(txt, size-1, &lastchar) && lastchar == '\n')
464 		lines--;
465-	lua_pushunsigned(L, lines);
466+	lua_pushinteger(L, lines);
467 	return 1;
468 }
469 
470@@ -2934,7 +2934,7 @@ static int window_marks_index(lua_State *L) {
471 	Array arr = vis_mark_get(win, mark);
472 	for (size_t i = 0, len = array_length(&arr); i < len; i++) {
473 		Filerange *range = array_get(&arr, i);
474-		lua_pushunsigned(L, i+1);
475+		lua_pushinteger(L, i+1);
476 		pushrange(L, range);
477 		lua_settable(L, -3);
478 	}
479@@ -2973,7 +2973,7 @@ static int window_marks_newindex(lua_State *L) {
480 }
481 
482 static int window_marks_len(lua_State *L) {
483-	lua_pushunsigned(L, VIS_MARK_INVALID);
484+	lua_pushinteger(L, VIS_MARK_INVALID);
485 	return 1;
486 }
487 
488@@ -3208,7 +3208,12 @@ static void *alloc_lua(void *ud, void *ptr, size_t osize, size_t nsize) {
489  * @function init
490  */
491 void vis_lua_init(Vis *vis) {
492-	lua_State *L = lua_newstate(alloc_lua, vis);
493+	lua_State *L =
494+#if LUA_VERSION_NUM >= 505
495+		lua_newstate(alloc_lua, vis, luaL_makeseed(NULL));
496+#else
497+		lua_newstate(alloc_lua, vis);
498+#endif
499 	if (!L)
500 		return;
501 	vis->lua = L;
502@@ -3308,7 +3313,7 @@ void vis_lua_init(Vis *vis) {
503 	};
504 
505 	for (size_t i = 0; i < LENGTH(textobjects); i++) {
506-		lua_pushunsigned(L, textobjects[i].id);
507+		lua_pushinteger(L, textobjects[i].id);
508 		lua_pushcclosure(L, file_text_object, 1);
509 		lua_setfield(L, -2, textobjects[i].name);
510 	}
511@@ -3341,7 +3346,7 @@ void vis_lua_init(Vis *vis) {
512 	};
513 
514 	for (size_t i = 0; i < LENGTH(styles); i++) {
515-		lua_pushunsigned(L, styles[i].id);
516+		lua_pushinteger(L, styles[i].id);
517 		lua_setfield(L, -2, styles[i].name);
518 	}
519 
520@@ -3360,7 +3365,7 @@ void vis_lua_init(Vis *vis) {
521 
522 	obj_type_new(L, VIS_LUA_TYPE_UI);
523 	luaL_setfuncs(L, ui_funcs, 0);
524-	lua_pushunsigned(L, vis->ui->colors(vis->ui));
525+	lua_pushinteger(L, vis->ui->colors(vis->ui));
526 	lua_setfield(L, -2, "colors");
527 	lua_newtable(L);
528 	static const struct {
529@@ -3371,7 +3376,7 @@ void vis_lua_init(Vis *vis) {
530 		{ UI_LAYOUT_VERTICAL, "VERTICAL" },
531 	};
532 	for (size_t i = 0; i <  LENGTH(layouts); i++) {
533-		lua_pushunsigned(L, layouts[i].id);
534+		lua_pushinteger(L, layouts[i].id);
535 		lua_setfield(L, -2, layouts[i].name);
536 	}
537 	lua_setfield(L, -2, "layouts");
538@@ -3401,7 +3406,7 @@ void vis_lua_init(Vis *vis) {
539 		{ VIS_MODE_REPLACE,          "REPLACE"          },
540 	};
541 	for (size_t i = 0; i < LENGTH(modes); i++) {
542-		lua_pushunsigned(L, modes[i].id);
543+		lua_pushinteger(L, modes[i].id);
544 		lua_setfield(L, -2, modes[i].name);
545 	}
546 	lua_setfield(L, -2, "modes");
547-- 
5482.49.0
549