I have one trouble, i need php's "addslashes" in lua. Have the Lua such function? Or who have the script, that doing this?
Ps: Sorry for my english ;)
what does it do ?
QuoteReturns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
;)
QuoteOriginally posted by TyShkan
QuoteReturns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
;)
QuoteStrings in Lua can contain the
following C-like escape sequences:
\a bell
\b back space
\f form feed
\n newline
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\" double quote
\? single quote
maybe this will do .. ( not tested at all .. )
function addEscapes(str)
local t = {
[1] = "\"",
[2] = "'",
[3] = "\\"
}
for i , v in t do
if strfind(str, v) then
str = gsub(str, v, "\\"..v)
end
end
return str
end