lua-users home
lua-l archive

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



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/