lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Perfect!
Thanks!!!
By the way I am using this solution/workaround:

  split = function (str, pat)
      local arr = {}
      string.gsub(str, pat or "([^%s]+)", function (word)
          table.insert(arr, word)
        end)
      return arr
    end
  splitlines = function (bigstr)
      local arr = split(bigstr, "([^\n]*)\n?")
      if _VERSION:sub(5) < "5.3" then
        table.remove(arr)
      end
      return arr
    end

Now dednat6 works with versions of lualatex that use Lua 5.3 - and I
think that the line with "_VERSION:sub(5)" screams "I AM A TEMPORARY
FIX" loud enough.

  Cheers =) =),
    Eduardo Ochs
    http://angg.twu.net/dednat6.html

On Mon, 12 Aug 2019 at 15:44, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> It seems that the behavior of string.gsub changed from 5.2 to 5.3. In
> 5.1 and 5.2 the
>
>   arr = split(bigstr, "([^\n]*)\n?")
>
> would always generate an sequence with an empty string at its end, and
> table.remove would delete it.
>
> I remember ___veeeery___ vaguely a discussion here in the list about a
> change in string.gsub that made it stop substituting the empty sting
> at the end, but I'm not being able to find it now... anyone has a
> pointer to it?

- http://lua-users.org/lists/lua-l/2013-04/msg00812.html
- http://lua-users.org/lists/lua-l/2016-05/msg00198.html

See also commit 783aa8a9da5f3.

-- Roberto