lua-users home
lua-l archive

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

On 11/7/06, Roberto Ierusalimschy <> wrote:
> Lua authors will decide if this is mis-description or mis-behavior :)

In this particular case, it seems simpler to declare the code right and
correct the manual. We have to clarify the manual anyway. The other
option (to really count "replacements") would need further clarification
of what counts as a "replacement".

-- Roberto

Thanks, Roberto!!
Counting matches instead of replacements IMHO is simpler to understand
and use. It also provides an easy way to count how many times a given
pattern occur in a string.

path= "/many/nested/directories"
_,n= path:gsub("/",{})  -- n counts "/" chars