Advertisement
OwainOwjo

Untitled

Apr 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. function client:escape(val)
  2. if nil == val then
  3. return "NULL"
  4. end
  5. if type(val)=="boolean" then
  6. if val then return "true" else return "false" end
  7. end
  8. if type(val)=="number" then
  9. return tostring(val)
  10. end
  11. if type(val)=="table" then
  12. if type( val.toISOString ) == "function" then
  13. return val:toISOString()
  14. else
  15. return tostring(val)
  16. end
  17. end
  18.  
  19. -- to escape "\0" in lua, we cannot use string.gsub.
  20. val = Util.escapeString( val )
  21. return "'" .. val .. "'"
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement