lua-users home
lua-l archive

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


On 1/3/2011 9:21 AM, Steve Litt wrote:
[snip]
	str = string.gsub(str, v, response)

******************************************
slitt@mydesk:~/ulua/program$ ./test.lua
B4 , str=>mycommand %c%Carg please=>%% %b%Barg please=>%% %a%Aarg please=>%%
final args
Aarg please=>al
%a%Aarg please=>%%
al

v = "%a%Aarg please=>%%"
response = "al"

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)

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia