--Wraps all I/O using rot13 encoding. print("Running rot13, super is", super) local rot13_c = function (c) local a = string.byte "a" local z = string.byte "z" local A = string.byte "A" local Z = string.byte "Z" local byte = string.byte(c) if byte >= a and byte <= z then return string.char(((byte - a) + 13) % 26 + a) elseif byte >= A and byte <= Z then return string.char(((byte - A) + 13) % 26 + A) else return c end end local rot13 = function (s) return (string.gsub(s, ".", function (c) return rot13_c(c) end)) end return { recv = function (self) local line, err = super:recv() if line == nil then return line, err end return rot13(line) end, send = function (self, data) return super:send(rot13(data)) end, }