Nieuwe pagina aangemaakt met '-- @param string jsonstr -- @todo: use new lua function that comes with WSSlots local p = {} function p.main ( frame ) local jsonstr = frame.args['jsonstr'] loc...' |
Geen bewerkingssamenvatting |
||
| Regel 1: | Regel 1: | ||
-- @param string jsonstr | -- @param string jsonstr | ||
-- @todo: use new | -- @todo: use new Lua function that comes with WSSlots (available since Feb) | ||
local p = {} | local p = {} | ||
| Regel 11: | Regel 11: | ||
function p.subobject( frame ) | function p.subobject( frame ) | ||
local jsonstr = frame.args['jsonstr'] or nil | |||
if jsonstr == nil or jsonstr == "" then | |||
return error("No JSON string found") | |||
end | |||
local jsondata = mw.text.jsonDecode( jsonstr ) | |||
local awardsTitle = jsondata["Title"] | |||
local firstWinner = jsondata["Awards"][1]["winner"] | |||
local winners = jsondata["Awards"] | |||
end | end | ||
-- return p | -- return p | ||
Versie van 2 jun 2023 11:02
Module:Read award recognition
-- @param string jsonstr
-- @todo: use new Lua function that comes with WSSlots (available since Feb)
local p = {}
function p.main ( frame )
local jsonstr = frame.args['jsonstr']
local output = jsonstr
return output
end
function p.subobject( frame )
local jsonstr = frame.args['jsonstr'] or nil
if jsonstr == nil or jsonstr == "" then
return error("No JSON string found")
end
local jsondata = mw.text.jsonDecode( jsonstr )
local awardsTitle = jsondata["Title"]
local firstWinner = jsondata["Awards"][1]["winner"]
local winners = jsondata["Awards"]
end
-- return p
