Nieuwe pagina aangemaakt met 'local p = {} --[[ {{#invoke:Slot|getParamValue |slot= // defaults to main |page= // defaults to FULLPAGENAME |template= |param= ]]-- p.getParamValue = function ( frame ) local slot = frame.args.slot or "main" local page = frame.args.page or "" if page == "" then page = mw.title.getCurrentTitle().fullText end local slotData = {} slotData = mw.slots.slotData(slot,page) local template = frame.args.template or nil local param = frame.args.param or ""…'
 
Geen bewerkingssamenvatting
Regel 16: Regel 16:
local template = frame.args.template or nil
local template = frame.args.template or nil
local param = frame.args.param or ""
local param = frame.args.param or ""
if slotData == {} then mw.log( "No slot data found" ) end


local res = ""
local res = ""
if template ~= nil then
if template ~= nil then
local tree = slotData[template]
local tree = slotData[template]
if tree[param] ~= nil then
if tree ~= nil and tree[param] ~= nil then
res = tree[param]["_text"]
res = tree[param]["_text"]
end
end

Versie van 4 sep 2025 08:49

Documentatie voor deze module kan aangemaakt worden op de volgende pagina: Module:Slot/doc

local p = {}

--[[
{{#invoke:Slot|getParamValue
|slot= // defaults to main
|page= // defaults to FULLPAGENAME
|template=
|param=
]]--
p.getParamValue = function ( frame )
	local slot = frame.args.slot or "main"
	local page = frame.args.page or ""
	if page == "" then page = mw.title.getCurrentTitle().fullText end
    local slotData = {}
    slotData = mw.slots.slotData(slot,page)
	local template = frame.args.template or nil
	local param = frame.args.param or ""
	
	if slotData == {} then mw.log( "No slot data found" ) end

	local res = ""
	if template ~= nil then
		local tree = slotData[template]
		if tree ~= nil and tree[param] ~= nil then
			res = tree[param]["_text"]
		end
	else
		--
	end
	
	return "not ready " .. res
end

return p