Module:MagazineVariables

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 21:35, 27 December 2023 by HudgynS (talk | contribs)
Jump to navigation Jump to search

Documentation for this module may be created at Module:MagazineVariables/doc

local p = {}

function p.main( frame )
    local magazineVariablesText = frame.args[1]
    local magazineVariablesData = ""
    local magazineVariablesResult = ""
    if frame.args[2] == nil then
	    magazineVariablesData = mw.loadData( 'Module:MagazineVariables/data' )
	else
		magazineVariablesData = mw.loadData( 'Module:MagazineVariables/data/' .. frame.args[2]  )
	end
    if frame.args[2] == 'ja' then
        if magazineVariablesData[magazineVariablesText] == "" then
            magazineVariablesResult = "type2=R"
        else
            magazineVariablesResult = frame:preprocess(magazineVariablesData[magazineVariablesText])
        end
    else
        magazineVariablesResult = magazineVariablesData[magazineVariablesText]
    end
    return magazineVariablesResult or magazineVariablesText or ""
end

return p