Re: string.sub and __call metamethod
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: string.sub and __call metamethod
- From: Shmuel Zeigerman <shmuz@...>
- Date: 2008年10月17日 14:22:10 +0200
Luiz Henrique de Figueiredo wrote:
Though var:sub(i,j) is shorter than string.sub(var,i,j), I often feel
that it's still too long for this very basic operation.
But is it that basic? I found myself extracting substrings mostly
through patterns.
IMHO, it is the most basic of all the string functions ("basic" and
"frequently used" isn't the same thing).
[Off-topic]
Out of curiosity, I inspected Lua files in my local repository to find
out the frequency of use of the string functions (including Lrexlib and
LPeg ones):
match 876
gsub 260
find 220
sub 215
gmatch 74
[/Off-topic]
--
Shmuel