lua-users home
lua-l archive

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

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)
      return arr
  splitlines = function (bigstr)
      local arr = split(bigstr, "([^\n]*)\n?")
      if _VERSION:sub(5) < "5.3" then
      return arr

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

On Mon, 12 Aug 2019 at 15:44, Roberto Ierusalimschy <> 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?


See also commit 783aa8a9da5f3.

-- Roberto