Module:EpisodeVariables

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 17:54, 25 July 2023 by HudgynS (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

local p = {}

function p.main( frame )
    local episodeVariablesText = frame.args[1]
    local episodeVariablesData = ""
    local episodeVariablesResult = ""
    if frame.args[2] == nil then
	    episodeVariablesData = mw.loadData( 'Module:EpisodeVariables/data' )
	else
		episodeVariablesData = mw.loadData( 'Module:EpisodeVariables/data/' .. frame.args[2]  )
	end
    if frame.args[2] == 'ja' then
        episodeVariablesResult = frame:preprocess(episodeVariablesData[episodeVariablesText])
    else
        episodeVariablesResult = episodeVariablesData[episodeVariablesText]
    end
    return episodeVariablesResult or episodeVariablesText or ""
end

return p