Module:CryptogullJr: Difference between revisions

139 bytes added ,  14:25, 7 August 2023
error handling
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 decoded = mw.text.jsonDecode(zlib.gzdecode(zlib.base64_decode(code)))
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"]