Re: Problem with table key iteration when string keys are unpredictable
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Problem with table key iteration when string keys are unpredictable
- From: Petite Abeille <petite.abeille@...>
- Date: 2013年5月21日 20:14:27 +0200
On May 21, 2013, at 1:24 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
> which is probably not what you wanted. So you need to put a few more escapes in there (at least before `%`, `.`, and `-`) …
Quoting the manual… "Any punctuation character (even the non magic) can be preceded by a '%' when used to represent itself in a pattern."… so… perhaps this can all be simplified to just gsub( '%p', '%%%0' ) )…
For example:
print( ( '1234-5;:/<>.%' ):gsub( '%p', '%%%0' ) )
> 1234%-5%;%:%/%<%>%.%% 8
http://www.lua.org/manual/5.2/manual.html#6.4.1