Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 20 lines (19 sloc) 475 Bytes
#!/usr/bin/env lua
local data = io.stdin:read('*a')
data = data:gsub('.', function(c)
local byte = c:byte(1)
if c == '"' then
return [[\"]]
elseif c == [[\]] then
return [[\\]]
elseif byte >= 32 and byte <= 126 then
return c
elseif c == '\n' then
return [[\n"]] .. '\n' .. [["]]
elseif c == '\t' then
return [[\t]]
else
return ([[\%3o]]):format(byte)
end
end)
io.stdout:write('"', data, '"\n')