Jump to content

Module:User:Mr rnddude/Sandbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr rnddude (talk | contribs) at 15:54, 19 April 2017 (Gap). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- This is my module sandbox.
-- Simple repetition module.
-- At Sea level on an ISA day,
-- the pressure should be 1013.2 hPa.
-- I've reduced this to 1013 hPa. Up to
-- 5,000 feet the pressure reduces by 1
-- hPa per 30 feet. Beyond 5,000 feet
-- the rate of reduction decreases. Off
-- the top of my head I can't remember
-- what it is (1/27ft?), but, whatever.

P = 1013 -- hPa
Incr = 30 -- feet
MSL = 0 -- feet

local p = {}

function p.Altitude (frame)
	output = "(Feet)"
	repeat
		MSL = MSL + Incr
		P = P - 1
		output = output .. "<br />" .. MSL .. ", " .. P
	until (MSL > 5000 or P < 0)
	return 'Altitude ' .. ", " .. 'Pressure' .. output
end

return p