Skip to content

Instantly share code, notes, and snippets.

@Tim-Machine
Created November 30, 2015 22:14
Show Gist options
  • Select an option

  • Save Tim-Machine/80adea8b499bcf0da5df to your computer and use it in GitHub Desktop.

Select an option

Save Tim-Machine/80adea8b499bcf0da5df to your computer and use it in GitHub Desktop.
JSON = (loadfile "json.lua")()
local serpent = require "serpent0272"
local inflate = require "deflatelua"
local base64 = require "base64"
function parse(data)
if (string.sub(data, 1, 8) ~= "do local") then
-- Decompress string
local output = {}
local input = base64.dec(data)
local status, result = pcall(inflate.gunzip, { input = input, output = function(byte) output[#output+1] = string.char(byte) end })
if (status) then
data = table.concat(output)
else
return nil
end
end
local status, result = serpent.load(data)
if (not status) then
return nil
end
json = JSON:encode(result)
print(json)
end
parse(arg[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment