Module:Sandbox: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
function p.main(frame) | function p.main(frame) | ||
local args = frame.args | local args = frame.args | ||
local output = "<table class=\"templateTheme\" style=\"text-align: center; margin: auto; width: 50%;\">\n" | local output = "<table class=\"templateTheme\" style=\"text-align: center; margin: auto; width: 50%;\">\n" | ||
-- Header row | -- Header row | ||
Line 29: | Line 26: | ||
output = output .. "</tr>\n" | output = output .. "</tr>\n" | ||
-- Data rows | -- Data rows | ||
for i = 1, rows | for i = 1, 100 do | ||
local monsterArg = args["monster_" .. i] | |||
local floorArg = args["floor_" .. i] | |||
if not monsterArg and not floorArg then | |||
break -- exit loop when no more rows are found | |||
end | |||
output = output .. "<tr class=\"monstersTableRow\">\n" | output = output .. "<tr class=\"monstersTableRow\">\n" | ||
output = output .. "<th class=\"templatePrimary\">\{\{Etrian1Model\|" .. ( | output = output .. "<th class=\"templatePrimary\">\{\{Etrian1Model\|" .. (monsterArg or "") .. "\}\}</th>\n" | ||
output = output .. "<td class=\"templateSecondary\">\{\{Etrian1\|" .. ( | output = output .. "<td class=\"templateSecondary\">\{\{Etrian1\|" .. (monsterArg or "") .. "\}\}</td>\n" | ||
output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. ( | output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. (monsterArg or "") .. "\|getVar=ja\}\}</td>\n" | ||
output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. ( | output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. (monsterArg or "") .. "\|getVar=exp\}\}</td>\n" | ||
output = output .. "<td class=\"templateSecondary\">" .. ( | output = output .. "<td class=\"templateSecondary\">" .. (floorArg or "") .. "</td>\n" | ||
output = output .. "</tr>\n" | output = output .. "</tr>\n" | ||
end | end |
Revision as of 09:35, 26 March 2023
----------------------------------------------------------------------------------------------------
--
-- Module:Sandbox
--
-- Here you can set anything you want in this sandbox, as long as it uses the language Lua.
-- Do not forget to add {{#invoke:Sandbox|<function name>}} in your template.
-- [[Category:Sandbox]]
--
----------------------------------------------------------------------------------------------------
local p = {}
function p.main(frame)
local args = frame.args
local output = "<table class=\"templateTheme\" style=\"text-align: center; margin: auto; width: 50%;\">\n"
-- Header row
output = output .. "<tr>\n"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 1rem 0 0 0; width: 10%;\">Model</th>\n"
output = output .. "<th class=\"templatePrimary\" colspan=\"2\">\{\{Etrian1\|Monsters\}\}</th>\n"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"width: 20%;\">\{\{Etrian1\|Experience\}\}</th>\n"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 0 1rem 0 0; width: 20%;\">Floors</th>\n"
output = output .. "</tr>\n"
output = output .. "<tr>\n"
output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">English</th>\n"
output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">Japanese</th>\n"
output = output .. "</tr>\n"
-- Data rows
for i = 1, 100 do
local monsterArg = args["monster_" .. i]
local floorArg = args["floor_" .. i]
if not monsterArg and not floorArg then
break -- exit loop when no more rows are found
end
output = output .. "<tr class=\"monstersTableRow\">\n"
output = output .. "<th class=\"templatePrimary\">\{\{Etrian1Model\|" .. (monsterArg or "") .. "\}\}</th>\n"
output = output .. "<td class=\"templateSecondary\">\{\{Etrian1\|" .. (monsterArg or "") .. "\}\}</td>\n"
output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. (monsterArg or "") .. "\|getVar=ja\}\}</td>\n"
output = output .. "<td class=\"templateSecondary\">\{\{#invoke:Etrian 1 Monster Data Cell\|etrian1MonsterDataCell\|name=" .. (monsterArg or "") .. "\|getVar=exp\}\}</td>\n"
output = output .. "<td class=\"templateSecondary\">" .. (floorArg or "") .. "</td>\n"
output = output .. "</tr>\n"
end
output = output .. "</table>"
return output
end
return p