Module:Convert: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(builtin hand units default to show name not symbol since "h" is "hour" and is uncommon for "hand")
("per" units can have a scale multiplier (for the units that used to be "mass per unit area" but are now "pressure"))
Line 428: Line 428:
local per = self.per
local per = self.per
local unit1, unit2 = per[1], per[2]
local unit1, unit2 = per[1], per[2]
value = (unit1 and unit1.scale or 1) / unit2.scale
value = (unit1 and unit1.scale or 1) * self.scalemultiplier / unit2.scale
elseif key == 'builtin' then
elseif key == 'builtin' then
value = false
value = false
Line 496: Line 496:
if per then
if per then
local result = { utype = t.utype, per = {} }
local result = { utype = t.utype, per = {} }
result.scalemultiplier = t.multiplier or 1
override_from(result, t, { 'invert', 'iscomplex', 'default', 'link', 'symbol', 'symlink' })
override_from(result, t, { 'invert', 'iscomplex', 'default', 'link', 'symbol', 'symlink' })
result.symbol_raw = (result.symbol or false) -- to distinguish between a defined exception and a metatable calculation
result.symbol_raw = (result.symbol or false) -- to distinguish between a defined exception and a metatable calculation