Skip to content

Instantly share code, notes, and snippets.

@creationix
Created January 25, 2017 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/00d31eda01bb2aaca1091666b1c39f31 to your computer and use it in GitHub Desktop.
Save creationix/00d31eda01bb2aaca1091666b1c39f31 to your computer and use it in GitHub Desktop.
local find = string.find
local sub = string.sub
local function decode(chunk)
local i = find(chunk, "\n", 1, true)
if not i then return end
return sub(chunk, 1, i - 1), sub(chunk, i + 1)
end
local function encode(line)
return line .. "\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment