Module:Sandbox: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
Tag: Manual revert
No edit summary
Line 16: Line 16:
     local cols = tonumber(args.cols) or 0
     local cols = tonumber(args.cols) or 0
     local table_class = args.class or "wikitable"
     local table_class = args.class or "wikitable"
     local output = "{| class=\"" .. table_class .. "\"\n"
     local output = "<table class=\"templateTheme\" style=\"text-align: center; margin: auto; width: 50%;\">\n"
     -- Header row
     -- Header row
     output = output .. "|-\n"
     output = output .. "<tr>\n"
    for j = 1, cols do
output = output .. "<tr>"
        output = output .. "! " .. (args["h" .. j] or "") .. "\n"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 1rem 0 0 0; width: 10%;\">Model</th>"
    end
output = output .. "<th class=\"templatePrimary\" colspan=\"2\">{{Etrian1|Monsters}}</th>"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"width: 20%;\">{{Etrian1|Experience}}</th>"
output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 0 1rem 0 0; width: 20%;\">Floors</th>"
output = output .. "</tr>"
output = output .. "<tr>"
output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">English</th>"
output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">Japanese</th>"
output = output .. "</tr>"
     -- Data rows
     -- Data rows
     for i = 1, rows do
     for i = 1, rows do
        output = output .. "|-\n"
    output = output .. "<tr class=\"monstersTableRow\">"
        for j = 1, cols do
output = output .. "<th class=\"templatePrimary\">{{Etrian1Model|" .. (args["monster_" .. i] or "") .. "}}</th>"
            output = output .. "| " .. (args[i .. "_" .. j] or "") .. "\n"
output = output .. "<td class=\"templateSecondary\">{{Etrian1|" .. (args["monster_" .. i] or "") .. "}}</td>"
        end
output = output .. "<td class=\"templateSecondary\">{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=" .. (args["monster_" .. i] or "") .. "|getVar=ja}}</td>"
output = output .. "<td class=\"templateSecondary\">{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=" .. (args["monster_" .. i] or "") .. "|getVar=exp}}</td>"
output = output .. "<td class=\"templateSecondary\">" .. (args["floor_" .. i] or "") .. "</td>"
        output = output .. "</tr>\n"
     end
     end
     output = output .. "|}\n"
     output = output .. "</table>\n"
     return output
     return output
end
end


return p
return p

Revision as of 09:27, 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 rows = tonumber(args.rows) or 0
    local cols = tonumber(args.cols) or 0
    local table_class = args.class or "wikitable"
    local output = "<table class=\"templateTheme\" style=\"text-align: center; margin: auto; width: 50%;\">\n"
    -- Header row
    output = output .. "<tr>\n"
	output = output .. "<tr>"
	output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 1rem 0 0 0; width: 10%;\">Model</th>"
	output = output .. "<th class=\"templatePrimary\" colspan=\"2\">{{Etrian1|Monsters}}</th>"
	output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"width: 20%;\">{{Etrian1|Experience}}</th>"
	output = output .. "<th class=\"templatePrimary\" rowspan=\"2\" style=\"border-radius: 0 1rem 0 0; width: 20%;\">Floors</th>"
	output = output .. "</tr>"
	output = output .. "<tr>"
	output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">English</th>"
	output = output .. "<th class=\"templatePrimary\" style=\"width: 25%;\">Japanese</th>"
	output = output .. "</tr>"
    -- Data rows
    for i = 1, rows do
    	output = output .. "<tr class=\"monstersTableRow\">"
		output = output .. "<th class=\"templatePrimary\">{{Etrian1Model|" .. (args["monster_" .. i] or "") .. "}}</th>"
		output = output .. "<td class=\"templateSecondary\">{{Etrian1|" .. (args["monster_" .. i] or "") .. "}}</td>"
		output = output .. "<td class=\"templateSecondary\">{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=" .. (args["monster_" .. i] or "") .. "|getVar=ja}}</td>"
		output = output .. "<td class=\"templateSecondary\">{{#invoke:Etrian 1 Monster Data Cell|etrian1MonsterDataCell|name=" .. (args["monster_" .. i] or "") .. "|getVar=exp}}</td>"
		output = output .. "<td class=\"templateSecondary\">" .. (args["floor_" .. i] or "") .. "</td>"
        output = output .. "</tr>\n"
    end
    output = output .. "</table>\n"
    return output
end

return p