8,756
edits
No edit summary |
(error handling) |
||
Line 24: | Line 24: | ||
function p.decode(code, title, author) | function p.decode(code, title, author) | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
local | local gzdecode = zlib.gzdecode(zlib.base64_decode(code)) | ||
if gzdecode == false then -- error handling | |||
error("This code isn't in base64. Please double check your input!") | |||
end | |||
local decoded = mw.text.jsonDecode() | |||
local version = decoded["gameversion"] | local version = decoded["gameversion"] |