Модуль:Filename: различия между версиями
Нет описания правки |
Нет описания правки |
||
| Строка 1: | Строка 1: | ||
local Filename = {} | local Filename = {} | ||
local lib = require('Модуль:Feature') | local lib = require('Модуль:Feature') | ||
local | local UserError = require("Dev:User error") | ||
function Filename.herosquare(frame) | function Filename.herosquare(frame) | ||
| Строка 13: | Строка 13: | ||
icon = heroData.get{hero, "icon"} | icon = heroData.get{hero, "icon"} | ||
else | else | ||
return | return UserError( | ||
mw.ustring.format( | mw.ustring.format( | ||
"Герой %s не найден в Модуль:HeroData/data (message from Модуль:Filename)", | "Герой %s не найден в Модуль:HeroData/data (message from Модуль:Filename)", | ||
Версия от 15:31, 3 января 2022
local Filename = {}
local lib = require('Модуль:Feature')
local UserError = require("Dev:User error")
function Filename.herosquare(frame)
local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end
local hero = args["hero"] or args[1]
local heroData = require("Модуль:HeroData")
if(heroData.get{hero, "exists"}) then
icon = heroData.get{hero, "icon"}
else
return UserError(
mw.ustring.format(
"Герой %s не найден в Модуль:HeroData/data (message from Модуль:Filename)",
hero),
"LuaError")
end
return mw.ustring.format('%s', icon) or 'ChampionSquare.png'
end
return Filename