Nieuwe pagina aangemaakt met 'local p = {} --test test -- function p.main ( frame ) local jsonstr = frame.args['json'] local output = jsonstr return output end --[[ Store in SMW Consid...' |
Geen bewerkingssamenvatting |
||
| Regel 5: | Regel 5: | ||
]]-- | ]]-- | ||
function p.main ( frame ) | function p.main ( frame ) | ||
local | local json = frame.args['json'] | ||
local output = | local output = json | ||
return output | return output | ||
end | end | ||
| Regel 21: | Regel 21: | ||
]]-- | ]]-- | ||
function p.store( frame ) | function p.store( frame ) | ||
local | local json = frame.args['json'] or nil | ||
if | if json == nil or json == "" then | ||
--Fail silently | --Fail silently | ||
return | return | ||
| Regel 28: | Regel 28: | ||
--etc etc | --etc etc | ||
-- #set | |||
-- #subobjects | |||
local awardInstances = json["Awards"] or nil | |||
if awardInstances ~= nil then | |||
for i, v in ipairs( awardInstances ) do | |||
store_award_as_subobject( frame, v ) | |||
end | |||
end | |||
end | end | ||
--[[ | |||
Local helper function for p.store | |||
]]-- | |||
local function store_award_as_subobject( frame, args ) | |||
local rank = args["rank"] or nil | |||
end | |||
local function send_to_template( frame, templateName, argsTable ) | local function send_to_template( frame, templateName, argsTable ) | ||
Versie van 29 dec 2024 12:58
Module:Award category
local p = {}
--[[
test test
]]--
function p.main ( frame )
local json = frame.args['json']
local output = json
return output
end
--[[
Store in SMW
Consider using Lua version of parser function instead
{{#invoke:Award category
|store
|json={{#slot:ws-data|{{FULLPAGENAME}} }}
}}
]]--
function p.store( frame )
local json = frame.args['json'] or nil
if json == nil or json == "" then
--Fail silently
return
end
--etc etc
-- #set
-- #subobjects
local awardInstances = json["Awards"] or nil
if awardInstances ~= nil then
for i, v in ipairs( awardInstances ) do
store_award_as_subobject( frame, v )
end
end
end
--[[
Local helper function for p.store
]]--
local function store_award_as_subobject( frame, args )
local rank = args["rank"] or nil
end
local function send_to_template( frame, templateName, argsTable )
if templateName ~= nil and argsTable ~= nil then
return frame:expandTemplate{ title = templateName, args = argsTable }
else
return ""
end
end
