Module:ASBInput: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
-- note this function isn't designed to be used in other modules w/out modification |
-- note this function isn't designed to be used in other modules w/out modification |
||
function file(name, size) |
function file(name, size) |
||
if name then |
|||
return "[[File:" .. name .. "|" .. size .. "|link=]]" |
|||
else |
|||
return nil |
|||
end |
|||
end |
end |
||
Line 33: | Line 37: | ||
return final |
return final |
||
end |
end |
||
return p |
Latest revision as of 05:29, 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)
if name then
return "[[File:" .. name .. "|" .. size .. "|link=]]"
else
return nil
end
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