lua-users home
lua-l archive

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


On Mon, Jan 3, 2011 at 04:40, KHMan <keinhong@gmail.com> wrote:
> On 1/3/2011 9:21 AM, Steve Litt wrote:

> string.gsub() wants a pattern for the second operand. But you want to use v
> as a literal. So you need to escape those "%" (and perhaps other magic
> characters) and make gsub interpret v as a literal.

> "%a%Aarg please=>%%" => "%%a%%Aarg please=>%%%%" (I think)

This function may be useful:

https://github.com/lua-nucleo/lua-nucleo/blob/master/lua-nucleo/string.lua#L137-158

(I think that may actually be a reuse of some code on Lua-Users.)

Alexander.