“模块:少女歌剧/images”的版本间的差异
< 模块:少女歌剧
(内容扩充) |
小 (增加错误处理) |
||
第36行: | 第36行: | ||
function module.icon(name) | function module.icon(name) | ||
− | return mw.ustring.format("Icn-%s-%s.png", map[name][2], name) | + | local entry = map[name] |
+ | if entry then return mw.ustring.format("Icn-%s-%s.png", map[name][2], name) | ||
+ | else return nil | ||
+ | end | ||
end | end | ||
function module.uniform(name) | function module.uniform(name) | ||
− | return mw.ustring.format("%s uniform.png", map[name][1]) | + | local entry = map[name] |
+ | if entry then return mw.ustring.format("%s uniform.png", map[name][1]) | ||
+ | else return nil | ||
+ | end | ||
end | end | ||
function module.revue(name) | function module.revue(name) | ||
− | return mw.ustring.format("%s revue.png", map[name][1]) | + | local entry = map[name] |
+ | if entry then return mw.ustring.format("%s revue.png", map[name][1]) | ||
+ | else return nil | ||
+ | end | ||
end | end | ||
第50行: | 第59行: | ||
local entry = map[name] | local entry = map[name] | ||
if entry then return entry[3] | if entry then return entry[3] | ||
− | else return | + | else return nil |
end | end | ||
end | end | ||
return module | return module |
2020年8月15日 (六) 09:49的最新版本
此模块的文档可以在模块:少女歌剧/images/doc创建
local module = {} local map = { ["karen"] = { "Karen Aijo", "seisho", "爱城华恋" }, ["hikari"] = { "Hikari Kagura", "seisho", "神乐光" }, ["maya"] = { "Maya Tendo", "seisho", "天堂真矢" }, ["junna"] = { "Hoshimi Junna", "seisho", "星见纯那" }, ["mahiru"] = { "Mahiru Tsuyuzaki", "seisho", "露崎真昼" }, ["nana"] = { "Karen Aijo", "seisho", "大场奈奈" }, ["claudine"] = { "Claudine Saijo", "seisho", "西条克洛迪娜" }, ["futaba"] = { "Futaba Isurugi", "seisho", "石动双叶" }, ["kaoruko"] = { "Kaoruko Hanayagi", "seisho", "花柳香子" }, ["tamao"] = { "Tamao Tomoe", "rinmeikan", "巴珠绪" }, ["yuyuko"] = { "Yuyuko Tanaka", "rinmeikan", "田中由由子" }, ["ichie"] = { "Ichie Otonashi", "rinmeikan", "音无一惠" }, ["rui"] = { "Rui Akikaze", "rinmeikan", "秋风垒" }, ["fumi"] = { "Fumi Yumeoji", "rinmeikan", "梦大路文" }, ["aruru"] = { "Aruru Otsuki", "frontier", "大月阿露露" }, ["misora"] = { "Misora Kanou", "frontier", "叶美空" }, ["lalafin"] = { "Lalafin nonomiya", "frontier", "野野宫拉拉芬" }, ["tsukasa"] = { "Tsukasa Ebisu", "frontier", "惠比寿司" }, ["shizuha"] = { "Shizuha Kouchou", "frontier", "胡蝶静羽" }, ["akira"] = { "Akira Yukishiro", "siegfelt", "雪代晶" }, ["michiru"] = { "Michiru Otori", "siegfelt", "凤满" }, ["meifan"] = { "Meifan Liu", "siegfelt", "刘美帆" }, ["yachiyo"] = { "Yachiyo Tsuruhime", "siegfelt", "鹤姬八千代" }, ["shiori"] = { "Shiori Yumeoji", "siegfelt", "梦大路栞" }, ["kirin"] = { "Kirin", "other", "长颈鹿" }, ["elle"] = { "Elle", "other", "艾露" }, ["andrew"] = { "andrew", "other", "安德鲁" } } function module.icon(name) local entry = map[name] if entry then return mw.ustring.format("Icn-%s-%s.png", map[name][2], name) else return nil end end function module.uniform(name) local entry = map[name] if entry then return mw.ustring.format("%s uniform.png", map[name][1]) else return nil end end function module.revue(name) local entry = map[name] if entry then return mw.ustring.format("%s revue.png", map[name][1]) else return nil end end function module.officialName(name) local entry = map[name] if entry then return entry[3] else return nil end end return module