Module:Infobox ngation: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
mh>Viklo
(trying to make it so that you can have multiple rulers with different titles using a Lua script)
 
mh>Viklo
No edit summary
Line 3: Line 3:
local rulerTitlesRaw = frame.args["ruler-title"] or ""
local rulerTitlesRaw = frame.args["ruler-title"] or ""
local rulerTitles = {}
local rulerTitles = {}
for i in string.gmatch(frame.args["ruler-title"], "%S*;%S*") do
for i in string.gmatch(frame.args["ruler-title"], "%s*;%s*") do
table.insert(rulerTitles, i)
table.insert(rulerTitles, i)
end
end
local ret = ""
local ret = ""
local n = 0
local n = 0
for i in string.gmatch(frame.args["ruler"], "%S*;%S*") do
for i in string.gmatch(frame.args["ruler"], "%s*;%s*") do
n = n + 1
n = n + 1
local rulerTitle = rulerTitles[n] or "Ruler"
local rulerTitle = rulerTitles[n] or "Ruler"

Revision as of 16:26, 4 June 2024

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

local p = {}
p.generateGovernmentRulerList = function(frame)
	local rulerTitlesRaw = frame.args["ruler-title"] or ""
	local rulerTitles = {}
	for i in string.gmatch(frame.args["ruler-title"], "%s*;%s*") do
		table.insert(rulerTitles, i)
	end
	local ret = ""
	local n = 0
	for i in string.gmatch(frame.args["ruler"], "%s*;%s*") do
		n = n + 1
		local rulerTitle = rulerTitles[n] or "Ruler"
		ret = ret .. "<br>'''" .. rulerTitles[n] .. ":''' " .. i
	end
	return ret
end
return p