GE Lua Documentation

Press F to search!

escape_magic

Definition


-- @/lua/ge/ge_utils.lua:1434

-- Return the string 'str', with all magic (pattern) characters escaped.
function escape_magic(str)
  assert(type(str) == "string", "utils.escape: Argument 'str' is not a string.")
  local escaped = str:gsub('[%-%.%+%[%]%(%)%^%%%?%*%^%$]','%%%1')
  return escaped
end

Callers