[lltx] lualatex-math cannot find unpack function

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Mon Aug 5 16:51:04 CEST 2013


Am Samstag, den 03.08.2013, 21:21 +0200 schrieb Philipp Gesang:
> ···<date: 2013-08-03, Saturday>···<from: Wolfgang Jeltsch>···
> > I think I have found the source of the problem. In Lua 5.1, unpack is a
> > global function, while in Lua 5.2, it is a field of the global variable
> > table. To ensure compatibility with both Lua versions, some Lua files
> > (lualibs-basic-merged.lua, lualibs-lua.lua, and luaotfload-merged.lua)
> > contain the following code:
> > 
> >     if not table.unpack then
> >       table.unpack=_G.unpack
> >     elseif not unpack then
> >       _G.unpack=table.unpack
> >     end
> 
> Packages shouldn’t write to _G.

I’m aware that this is an ugly hack, not only because _G is modified,
but also because table is modified. I think it would be more appropriate
to use a local variable unpack defined as follows:

    local unpack
    if table.unpack then
        unpack = table.unpack
    else
        unpack = _G.unpack
    end

> > I will send a patch to Philipp Stephani.
> 
> Fyi I’ve already sent him a pull request.

Thank you.

Best wishes,
Wolfgang



More information about the lualatex-dev mailing list