Comprehending string.gsub
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Comprehending string.gsub
- From: Robert Virding <robert.virding@...>
- Date: 2012年4月13日 11:54:30 +0100 (BST)
I am having a bit of trouble comprehending a call to string.gsub in the pm.lua file in thelua-5.2.0 tests. There is a line:
assert(string.gsub("abc", "%w", "%1%0") == "aabbcc")
which works. My problem is that I don't why the substring %1 works and from where it gets its value. As far as I can see there is no captured substring at all. Using %2 generates an error (as I think it should).
Any help would be appreciated.
Robert