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