Add function to escape characters in Lua