Difference between revisions of "Module:Thought"
Jump to navigation
Jump to search
Arcangelus (talk | contribs) (This is either clever or a dumpster fire. I want to know if this is a viable way of writing it.) |
Arcangelus (talk | contribs) m |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
− | |||
-- "stack, "duration", "multi", "label", "desc", "label" | -- "stack, "duration", "multi", "label", "desc", "label" | ||
Line 9: | Line 8: | ||
return p.Thought(frame)..'<abbr title="'..frame.args["desc"]..'">'..frame.args["label"]:gsub("^%l", string.upper)..'</abbr>'.." [[mood]]" | return p.Thought(frame)..'<abbr title="'..frame.args["desc"]..'">'..frame.args["label"]:gsub("^%l", string.upper)..'</abbr>'.." [[mood]]" | ||
else | else | ||
− | + | return '<abbr title="'..p.stacks(frame)..'"> '..'<abbr title="'..frame.args["desc"]..'">'..frame.args["label"]:gsub("^%l", string.upper)..'</abbr>'.." [[mood]]" | |
end | end | ||
end | end | ||
Line 17: | Line 16: | ||
function p.Thought(frame)--This is just the value section. | function p.Thought(frame)--This is just the value section. | ||
valores_buscados={} | valores_buscados={} | ||
+ | valores_ingresados={"value", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9" } | ||
for i, j in ipairs(valores_ingresados) do | for i, j in ipairs(valores_ingresados) do | ||
local vz = valores_ingresados[i] | local vz = valores_ingresados[i] |
Revision as of 04:47, 16 August 2024
Documentation for this module may be created at Module:Thought/doc
local p = {} -- "stack, "duration", "multi", "label", "desc", "label" function p.Main(frame) Part1="" if frame.args["value"] then if frame.args["value2"] then return p.Thought(frame)..'<abbr title="'..frame.args["desc"]..'">'..frame.args["label"]:gsub("^%l", string.upper)..'</abbr>'.." [[mood]]" else return '<abbr title="'..p.stacks(frame)..'"> '..'<abbr title="'..frame.args["desc"]..'">'..frame.args["label"]:gsub("^%l", string.upper)..'</abbr>'.." [[mood]]" end end end function p.Thought(frame)--This is just the value section. valores_buscados={} valores_ingresados={"value", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9" } for i, j in ipairs(valores_ingresados) do local vz = valores_ingresados[i] local vx = frame.args[vx] local vy = "" if vx then -- Not a nil if tonumber(vx) then --A number if tonumber(vx)<0 then vy='<b><font color="firebrick">'..vx.."</font></b>" else vy='<b><font color="forestgreen">'..vx.."</font></b>" end else vy='<b>'..vx.."</b>" --The idea is to prevent a hard to track error end valores_buscados[#valores_buscados+1]=vx end end return "<b>"..table.concat(valores_buscados,"<b>/</b>").."</b>" end function p.stacks(frame)--This is just the stacking section. local stack = frame.args["stack"] local multi= frame.args["multi"] if frame.args["stack"] then local va= "Stacking "..stack.."times " if frame.args["multi"] == 1 then text= "for a maximum of "..tostring(frame.args["value"]*stack) else text= "with a "..multi.." multiplier for maximum of"..tostring(frame.args["value"]*( 1 - multi^stack)/(1 - multi)) end return va..text else if frame.args["multi"] == 1 then --What about a mult above 1? text = "Stacking infinitely" else text = "Stacking with a "..multi.." multiplier for maximum of "..tostring( frame.args["value"]*( 1 - multi^100)/(1 - multi) ) end return text end end