MetricUnitKinds
The named kinds of measurement, such as "length" and "speed": each a set of dimensions, absolute or a
difference. MetricUnit.GetKind, MetricUnit.isKind and MetricUnit.expect take these names. The dimension
functions they are built from are in MetricUnitDimensionUtils.
MetricUnitKinds.SPEED -- { length = 1, time = -1 }
MetricUnitKinds.fromName("speed") -- { length = 1, time = -1 }, false
MetricUnitKinds.getKind({ temperature = 1 }, true) -- "temperature"
Types
KindName
type KindName = "none" | "time" | "length" | "area" | "volume" | "memory" | "mass" | "rate" | "speed" | "acceleration" | "force" | "energy" | "power" | "pressure" | "density" | "dataRate" | "temperature" | "temperatureDifference" | "instant" | "angle" | "angularVelocity" | "angularAcceleration" | "current" | "charge" | "voltage" | "resistance" | "conductance" | "capacitance" | "inductance" | "magneticFlux" | "magneticFluxDensity" | "amount" | "luminousIntensity" | "solidAngle" | "luminousFlux" | "illuminance" | "absorbedDose" | "catalyticActivity" | "molarMass" | "molarConcentration" | "fuelEconomy"
A kind's name. "temperature" is an absolute temperature and "temperatureDifference" a difference between two.
"time" is a span of time and "instant" a point in time, measured from an epoch the caller chooses. "none" is
a plain, dimensionless number.
Functions
fromName
MetricUnitKinds.fromName(kind: KindName | Dimensions) → (boolean--
whether the name is of an absolute value
)The dimensions a KindName stands for, or the table given, and whether it names an absolute value. Errors on an unknown name.
getKind
The KindName of dimensions, absolute or a difference, or nil for a compound without a name.
MetricUnitKinds.getKind({ length = 1, time = -1 }, false) -- "speed"
MetricUnitKinds.getKind({ temperature = 1 }, true) -- "temperature"
MetricUnitKinds.getKind({ length = 4 }, false) -- nil
describeKind
What a value of dimensions is, absolute or a difference: "absolute temperature", "temperature difference",
"instant", "length/time".