- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:VoiceActor"
Jump to navigation
Jump to search
Line 32: | Line 32: | ||
function VoiceActor:get_module(name) | function VoiceActor:get_module(name) | ||
− | return name and mw.ustring.format('Module:VoiceActor/%s', name) or nil | + | return name and mw.ustring.format('Module:Data/VoiceActor/%s', name) or nil |
end | end | ||
Revision as of 11:51, 22 June 2020
Documentation for this module may be created at Module:VoiceActor/doc
local U = require('Module:Utils')
local VoiceActorData = require('Module:VoiceActorData')
local VoiceActor = {}
local voice_actors = {}
function VoiceActor:get(stat, name)
return self:create(name)[stat]()
end
local function requireVoiceActorModule(name)
local success, data = U.requireModule('VoiceActor/' .. name)
if not success then
success, data = U.requireModule('Data/VoiceActor/' .. name)
end
if not success then
data = {_name = name}
end
return data
end
function VoiceActor:create(name)
if not name then
return VoiceActorData()
end
if not voice_actors[name] then
voice_actors[name] = VoiceActorData(requireVoiceActorModule(name))
end
return voice_actors[name]
end
function VoiceActor:get_module(name)
return name and mw.ustring.format('Module:Data/VoiceActor/%s', name) or nil
end
function VoiceActor:extend(data)
data = data or {}
setmetatable(data, data)
data.__index = self
data.__call = self.__call
return data
end
VoiceActor.__call = VoiceActor.create
setmetatable(VoiceActor, VoiceActor)
return VoiceActor