database helpers (exactly one)

This commit is contained in:
Paul Liverman III 2018-03-13 02:09:45 -07:00
parent 7b7003b77a
commit 3616fc80e5

9
db.moon Normal file
View File

@ -0,0 +1,9 @@
escape_similar_to = (str) ->
-- matches any of %_\|*+?{}()[]
-- puts a backslash in front of them
str = str\gsub "[%%_\\|%*%+%?{}%(%)%[%]]", "\\%1"
return str -- return on seperate line to avoid returning 2nd value from gsub
{
:escape_similar_to
}