[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: String: addslashes
 
- From: Florian Berger <fberger@...>
 
- Date: Wed, 11 May 2005 21:43:28 +0300 (EEST)
 
Hi.
What is the best way to make strings safe when using database and files 
(saving string to them)? I'm trying to do something like in PHP: 
http://www.php.net/manual/en/function.addslashes.php
There were some examples in wiki:
http://lua-users.org/wiki/TextProcessing
So I made following function:
function addslashes(s)
  return (string.gsub(s, "([^'])'", "%1\'"))
end
I'm using apostrophes (') when using strings. Unfortunately my function 
does not seem to work all the time (for example with database queries)... 
:(
f