• Welcome to Touhou Wiki!
  • Registering is temporarily disabled. Check in our Discord server to request an account and for assistance of any kind.

Module:Test: Difference between revisions

From Touhou Wiki
Jump to navigation Jump to search
mNo edit summary
Tags: Mobile edit Mobile web edit
mNo edit summary
Tags: Mobile edit Mobile web edit
Line 13: Line 13:
--Get custom difficulties
--Get custom difficulties
local difficulty = {"Easy", "Medium", "Hard", "Lunatic"}
local difficulty = {"Easy", "Medium", "Hard", "Lunatic"}
for _, v in ipairs(args) do
for k, v in ipairs(args) do
   difficulty[i] = v
   difficulty[k] = v
end
end



Revision as of 03:08, 28 September 2022

Documentation for this module may be created at Module:Test/doc

local p = {}
function p.main(frame)

--Get article
local args = frame.args
local title = args.title
local title = mw.title.new(title)
local article = title:getContent()
local header = {}
local section = mw.text.split(article, "==.-==")
local i = 1

--Get custom difficulties
local difficulty = {"Easy", "Medium", "Hard", "Lunatic"}
for k, v in ipairs(args) do
   difficulty[k] = v
end

--Split article
for s in string.gmatch(article, "==(.-)==") do
   header[s] = section[i]
   i = i+1
end

--Add tabber tags
j = 1
for k, v in pairs(header) do
   v = k.."\n<tabber>"..v.."\n</tabber>"

   --Add tabber tabs
   for s in string.gmatch(v, "{{Spell Card Info") do
      v = string.gsub(v, "(}}\n)({{Spell Card Info)", "%1|%-|"..difficulty[j].."=\n%2", 1)
   j = j+1
   end 

end

output = mw.text.nowiki(header["Boss Spell Card #1"])
return output
end
return p