Skip to content

Patching of if_lua.c for lua 5.5 compatibilty#19842

Open
lyderic wants to merge 3 commits intovim:masterfrom
lyderic:master
Open

Patching of if_lua.c for lua 5.5 compatibilty#19842
lyderic wants to merge 3 commits intovim:masterfrom
lyderic:master

Conversation

@lyderic
Copy link
Copy Markdown

@lyderic lyderic commented Mar 27, 2026

This fixes #19814: Lua interface broken after Lua 5.5 upgrade (on Linux).

I used AI. I submitted the problem to OpenCode Zen and this is what it found:

Lua 5.5 renamed the function luaL_openlibs to luaL_openselectedlibs. The vim source code in src/if_lua.c still references the old function name:

  • Line 218: # define luaL_openlibs dll_luaL_openlibs
  • Line 334: void (*dll_luaL_openlibs) (lua_State *L);
  • Line 442: {"luaL_openlibs", (luaV_function) &dll_luaL_openlibs},
  • Line 2573: luaL_openlibs(L); // core libs

Verification via nm confirms the symbol doesn't exist in Lua 5.5:

$ nm -D /usr/lib/liblua.so.5.5.0 | grep luaL_openlibs
(nothing returned - symbol renamed)

OpenCode Zen patched if_lua.c and added conditions to test the lua version. I tried the patch on two configurations I have and it was successful:

  1. Arch Linux with lua 5.5
  2. Ubuntu 24.04 LTS with lua 5.4

I couldn't test on other configurations, in particular MacOS, Windows, BDS, Linux ARM etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lua interface broken after Lua 5.5 upgrade (on Linux)

1 participant