Skip to content

Commit

Permalink
escape case for slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Upbolt authored Nov 7, 2021
1 parent c796e04 commit 8d99524
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion methods/string.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ local function dataToString(data)

if dataType == "string" then
return '"' .. data:gsub('"', '\\"')
:gsub('\\', "\\\\")
:gsub('\n', "\\n")
:gsub("\t", "\\t")
:gsub('\f', '\\f')
Expand Down Expand Up @@ -66,4 +67,4 @@ end
methods.toString = toString
methods.dataToString = dataToString
methods.toUnicode = toUnicode
return methods
return methods

0 comments on commit 8d99524

Please sign in to comment.