vis/vis-0.9-lua-5.5.patch
Tom spot Callaway bb0fc38581 rebuild for lua 5.5
2026-03-16 16:32:00 -04:00

38 lines
1.4 KiB
Diff

diff -up vis-v0.9/vis-lua.c.lua55 vis-v0.9/vis-lua.c
--- vis-v0.9/vis-lua.c.lua55 2026-03-16 16:23:43.668922812 -0400
+++ vis-v0.9/vis-lua.c 2026-03-16 16:25:41.892362312 -0400
@@ -3208,7 +3208,11 @@ static void *alloc_lua(void *ud, void *p
* @function init
*/
void vis_lua_init(Vis *vis) {
+#if LUA_VERSION_NUM >= 505
+ lua_State *L = lua_newstate(alloc_lua, vis, luaL_makeseed(0));
+#else
lua_State *L = lua_newstate(alloc_lua, vis);
+#endif
if (!L)
return;
vis->lua = L;
diff -up vis-v0.9/vis-lua.h.lua55 vis-v0.9/vis-lua.h
--- vis-v0.9/vis-lua.h.lua55 2026-03-16 16:13:13.657846463 -0400
+++ vis-v0.9/vis-lua.h 2026-03-16 16:15:26.159364325 -0400
@@ -14,6 +14,19 @@ typedef void* lua_CFunction;
#include "vis.h"
#include "vis-subprocess.h"
+#if LUA_VERSION_NUM >= 505
+
+#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n))
+#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is))
+#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
+#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a))
+#define luaL_optunsigned(L,a,d) \
+ ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d)))
+#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
+
+#endif
+
+
/* add a directory to consider when loading lua files */
bool vis_lua_path_add(Vis*, const char *path);
/* get semicolon separated list of paths to load lua files