[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to upgrade string.gsub() from 5.0.2 to 5.1 (beta)
- From: PA <petite.abeille@...>
- Date: Tue, 20 Dec 2005 17:39:28 +0100
On Dec 19, 2005, at 22:36, Henderson, Michael D wrote:
Okay, I re-read Roberto Ierusalimschy's original post a couple three
times and added an empty string to my return statement. I am not sure
*why* it works, but it does.
As per the friendly manual:
Changes in the Libraries
"When string.gsub is called with a function as its third argument,
whenever that function returns nil or false the replacement string is
the whole match, instead of the empty string."
In other words, returning nil or false means "no substitution". If you
want to substitute an empty string, you now need to return it
explicitly.
Cheers
--
PA, Onnay Equitursay
http://alt.textdrive.com/