|
|
||
|
Shmuel Zeigerman <shmuz <at> actcom.co.il> writes:Let's see another example:
print (string.gsub ("abc123", "(.)", function(c) local n = tonumber(c) return n and n+1 end))
abc234 6It seems returning "abc234", 3 would make more sense.
Not at all... six (6) substitutions done.. thats all. thats what the dot do in Lua's regular expressions. try %d for numbers or %a for letters.
-- Philippe Lhoste -- (near) Paris -- France -- http://Phi.Lho.free.fr -- -- -- -- -- -- -- -- -- -- -- -- -- --