Module:PlantsPreferences: Difference between revisions

From Eco - English Wiki
[checked revision][checked revision]
No edit summary
No edit summary
Line 14: Line 14:
header = header .. "<th rowspan=\"3\">Plant</th> \n "
header = header .. "<th rowspan=\"3\">Plant</th> \n "
header = header .. "<th colspan=\"4\">Temperature Ranges (C<sup>o</sup>)</th> \n "
header = header .. "<th colspan=\"4\">Temperature Ranges (C<sup>o</sup>)</th> \n "
header = header .. "<th colspan=\"4\">Moisture Ranges</th> \n "
header = header .. "<th colspan=\"4\">Moisture Ranges (%)</th> \n "
header = header .. "<th colspan=\"4\">Salt Ranges</th> \n "
header = header .. "<th colspan=\"4\">Salt Ranges (%)</th> \n "
header = header .. "<th rowspan=\"2\" colspan=\"2\">Pollution (%)</th> \n "
header = header .. "<th rowspan=\"2\" colspan=\"2\">Pollution (%)</th> \n "
header = header .. "<th rowspan=\"3\">CO<sup>2</sup></th> \n "
header = header .. "</tr> \n "
header = header .. "</tr> \n "
Line 57: Line 58:
row = row .. "<td>" .. v.extremeTempMax * 40 - 10 .. " </td> \n"
row = row .. "<td>" .. v.extremeTempMax * 40 - 10 .. " </td> \n"


row = row .. "<td>" .. v.idealMoistureMin .. " </td> \n"
row = row .. "<td>" .. v.idealMoistureMin * 100 .. " </td> \n"
row = row .. "<td>" .. v.idealMoistureMax .. " </td> \n"
row = row .. "<td>" .. v.idealMoistureMax * 100 .. " </td> \n"
row = row .. "<td>" .. v.extremeMoistureMin .. " </td> \n"
row = row .. "<td>" .. v.extremeMoistureMin * 100 .. " </td> \n"
row = row .. "<td>" .. v.extremeMoistureMax .. " </td> \n"
row = row .. "<td>" .. v.extremeMoistureMax * 100 .. " </td> \n"


row = row .. "<td>" .. v.idealSaltMin .. " </td> \n"
row = row .. "<td>" .. v.idealSaltMin * 100 .. " </td> \n"
row = row .. "<td>" .. v.idealSaltMax .. " </td> \n"
row = row .. "<td>" .. v.idealSaltMax * 100 .. " </td> \n"
row = row .. "<td>" .. v.extremeSaltMin .. " </td> \n"
row = row .. "<td>" .. v.extremeSaltMin * 100 .. " </td> \n"
row = row .. "<td>" .. v.extremeSaltMax .. " </td> \n"
row = row .. "<td>" .. v.extremeSaltMax * 100 .. " </td> \n"


row = row .. "<td>" .. v.pollutionTolerance * 100 .. " </td> \n"
row = row .. "<td>" .. v.pollutionTolerance * 100 .. " </td> \n"

Revision as of 02:37, 19 February 2022

Documentation

This module provides the back end functionality of the Template:PlantsPreferences.

If the template is passed, this module creates a list using details from the following Modules:


local p = {}

function p.main()
	local wiki = ''

	-- import the required modules
	local PlantData = require( "Module:PlantData" )	
	
	local plants = PlantData.plants

	-- create the header of the table
	local header = "<table class=\"wikitable sortable\"> \n " 
	header = header .. "<tr> \n "
	header = header .. "<th rowspan=\"3\">Plant</th> \n "
	header = header .. "<th colspan=\"4\">Temperature Ranges (C<sup>o</sup>)</th> \n "
	header = header .. "<th colspan=\"4\">Moisture Ranges (%)</th> \n "
	header = header .. "<th colspan=\"4\">Salt Ranges (%)</th> \n "
	header = header .. "<th rowspan=\"2\" colspan=\"2\">Pollution (%)</th> \n "
	header = header .. "<th rowspan=\"3\">CO<sup>2</sup></th> \n "
	header = header .. "</tr> \n "
	
	header = header .. "<tr> \n "
	header = header .. "<th colspan=\"2\">Ideal</th> \n "
	header = header .. "<th colspan=\"2\">Extreme</th> \n "
	header = header .. "<th colspan=\"2\">Ideal</th> \n "
	header = header .. "<th colspan=\"2\">Extreme</th> \n "
	header = header .. "<th colspan=\"2\">Ideal</th> \n "
	header = header .. "<th colspan=\"2\">Extreme</th> \n "
	header = header .. "</tr> \n "

	header = header .. "<tr> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Min</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "<th>Tolerance</th> \n "
	header = header .. "<th>Max</th> \n "
	header = header .. "</tr> \n "

	wiki = header

	for k,v in pairs(plants) do
		local row = ''
		row = row .. "<tr> \n "

		row = row .. "<td>" .. "[[" .. k .. "]]" .. " </td> \n"
		row = row .. "<td>" .. v.idealTempMin * 40 - 10 .. " </td> \n"
		row = row .. "<td>" .. v.idealTempMax * 40 - 10 .. " </td> \n"
		row = row .. "<td>" .. v.extremeTempMin * 40 - 10 .. " </td> \n"
		row = row .. "<td>" .. v.extremeTempMax * 40 - 10 .. " </td> \n"

		row = row .. "<td>" .. v.idealMoistureMin * 100 .. " </td> \n"
		row = row .. "<td>" .. v.idealMoistureMax * 100 .. " </td> \n"
		row = row .. "<td>" .. v.extremeMoistureMin * 100 .. " </td> \n"
		row = row .. "<td>" .. v.extremeMoistureMax * 100 .. " </td> \n"

		row = row .. "<td>" .. v.idealSaltMin * 100 .. " </td> \n"
		row = row .. "<td>" .. v.idealSaltMax * 100 .. " </td> \n"
		row = row .. "<td>" .. v.extremeSaltMin * 100 .. " </td> \n"
		row = row .. "<td>" .. v.extremeSaltMax * 100 .. " </td> \n"

		row = row .. "<td>" .. v.pollutionTolerance * 100 .. " </td> \n"
		row = row .. "<td>" .. v.maxPollutionDensity * 100 .. " </td> \n"

		row = row .. "</tr>"
	wiki = wiki .. row
	end

	wiki = wiki .. " </table>"
	return wiki
	end
return p