nut.db.escape - brianhang/nutscript2 GitHub Wiki
Description
escaped = nut.db.escape(value)
This server function converts the given value into a string and then replaces special characters so it can be used with an SQL query.
Parameters
| Name |
Description |
value |
The value to escape. |
Returns
| Name |
Description |
escaped |
A string that is the escaped version of value. |
Example
local name = "\"Hello World!\""
nut.db.query("SELECT * FROM characters WHERE name = '"..nut.db.escape(name).."'", function(status, result)
if (status) then
PrintTable(result)
else
print("Error: "..result)
end
end)