Skip to content
Snippets Groups Projects
Commit 77f0be51 authored by Alex Dowad's avatar Alex Dowad
Browse files

main/lua-luaxml: Fix bug on Lua 5.2+

In earlier versions of Lua, registering a C library would automatically
create a global variable and store the library's table in it. In recent
versions of Lua, that is not the case.

However, LuaXml relied on its table being accessible in a global
variable called "xml". If this global variable was not defined, several
functions would break, including 'load' and 'eval'. If the XML
received as input contained any nodes at all, these functions would
fail with an error stating: "attempt to index a nil value".

The reason why LuaXml wanted to access its own table of functions was
to use those functions in the metatable for each parsed XML node.
Instead of that, we can set up one shared metatable and stash it in the
registry.

Also, remove liblua from LIBS, since Lua modules should not link
directly to liblua. (Ref: https://lua-users.org/wiki/BuildingModules)
parent 0432b2d7
No related branches found
No related tags found
1 merge request!30100main/lua-luaxml: fix broken LuaXml library on Lua 5.2+
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment