|
|
||
|
I am wondering why you find this omission so shocking? When I ran into the need for a function like this myself, I just added it in my own app and moved on:
function escape(text) return (text or ""):gsub("&", "&"):gsub(">",">"):gsub("<","<") end
Or this alternative:
function escape(text)
local escaped = { ['<']='<', ['>']='>', ["&"]='&' }
return text:gsub('[<>&]', function(c) return escaped[c] end)
endprint(escape('2 < 3 & 10 > 9'))