Module:ChapterVariables

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 17:36, 25 July 2023 by HudgynS (talk | contribs)
Jump to navigation Jump to search

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

local p = {}

function p.main( frame )
    local chapterVariablesText = frame.args[1]
    local chapterVariablesData = ""
    local chapterVariablesResult = ""
    if frame.args[2] == nil then
	    chapterVariablesData = mw.loadData( 'Module:ChapterVariables/data' )
	else
		chapterVariablesData = mw.loadData( 'Module:ChapterVariables/data/' .. frame.args[2]  )
	end
    if frame.args[2] == 'ja' then
        local chapterVariablesResult = frame:preprocess(chapterVariablesData[chapterVariablesText])
    else
        local chapterVariablesResult = chapterVariablesData[chapterVariablesText] or chapterVariablesText or ""
    end
    return chapterVariablesResult
end

return p