lua-users home
lua-l archive

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


> What may be more useful than another parameter to gsub would be
> a function string.plain, which returns a pattern that matches the
> exact string. Then one can write
>
>   str:gsub(pattern:plain(),repl)

Computationally speaking this would be like scratching ones head with the hand twisted three times around the head. Calculating a pattern just to parse it again to determine its just a simple string...

I agree that an additional parameter for gsub is nonsense. A string:replace function would be sensible tough, since it skips all pattern matching. Don't tell me how one can build such function with match and string concatenation. I think everbody firm with coding knows, but wonders, why s/he has to reinvent this wheel once again.

This issue viewed with from a step back, anything on Lua that begins with "feature request" is 100%ly to be shot down initially, with a 1% chance it might be picked up later anyway, when it is "invented here". Its the way that is.

Two steps back: boils down to the disadvantage of Lua having language core and basic util library boiled together, where for the second a from-the-shelf string replace function would be desirable, while Lua gospel is, forget the shelf, you'll have to do everything on your own.