lua-users home
lua-l archive

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


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:

There were some examples in wiki:

So I made following function:
function addslashes(s)
  return (string.gsub(s, "([^'])'", "%1\'"))

I'm using apostrophes (') when using strings. Unfortunately my function does not seem to work all the time (for example with database queries)... :(