lua-users home
lua-l archive

Re: string.sub and __call metamethod

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


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

AltStyle によって変換されたページ (->オリジナル) /