Module:ASBInput: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 33: | Line 33: | ||
return final |
return final |
||
end |
end |
||
return p |
Revision as of 05:25, 26 February 2024
Documentation for this module may be created at Module:ASBInput/doc
local p = {}
-- note this function isn't designed to be used in other modules w/out modification
function file(name, size)
return "[[File:" .. name .. "|" .. size .. "|link=]]"
end
-- retrieve input image associations
local inputFiles = mw.loadData("Module:ASBInput/Input_File_Data")
function p.main(frame)
local final = ""
for i, val in ipairs(frame:getParent().args) do
if i ~= 1 then
final = final .. " + "
end
-- convert presets (could make this a Lua table instead at some point)
if val == "ATK" then
input = "L/M/H"
else
input = val
end
-- loop through input symbols
for i = 1, string.len(input), 1 do
char = string.sub(input, i, i)
final = final .. ( file(inputFiles[char], "25px") or char or "" )
end
end
return final
end
return p