[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: updating libs for 5.3. How to replace unpack ?
- From: Tom N Harris <whoopdedo@...>
- Date: Thu, 07 May 2015 02:39:48 -0400
On Wednesday, May 06, 2015 12:19:14 PM Gaspard Bucher wrote:
> The "matcher.func" function can take different argument count depending on
> the captures in the pattern.
>
> Any thought on how to fix this with style ?
You could "abuse" the ability to use a function in string.gsub.
string.gsub(line, matcher.pattern, function(...)
matcher.func(self, line_i, ...)
end, 1)
The 1 to stop after one match can be omitted if you anchor the pattern. And
the return value doesn't matter since you're ignoring the substituted string.
--
tom <telliamed@whoopdedo.org>