Skip to main content

MetricUnitDefinitions

Every unit MetricUnit can be made in, read in, parsed from and written in. This list is where a unit is declared: its id, dimensions, size in SI base units, symbol, measurement system, English names and the other text it may be typed as. MetricUnit, MetricUnitFormatUtils, MetricUnitParseUtils and MetricUnitFallbackStrings all read it. Symbols are the SI ones (or the customary ones for US and imperial units), which do not change with the locale.

To add a unit:

  1. Add a row to the define call for its dimension and system below. See UnitRow for the fields. Give an SI unit prefixes rather than adding its prefixed forms: kilo, nano and the rest are made from it.
  2. Add its id to the UnitId union, with any prefixed forms games commonly name. luau-lsp rejects a row whose id is missing from it; other prefixed ids work at runtime.
  3. Add it to a system's display units in MetricUnitSystems if it should be picked by size.
  4. If it is written by name, add units.<id>.long.<category> and units.<id>.short.<category> for all six plural categories to every Localization/MetricUnitTranslator/<locale>.json.txt: English from this row, the other languages from CLDR's unit patterns. Prefixed forms need no entry; they are written from the prefixes section and the unit's own entry.
  5. Only for a unit games construct constantly, add a named constructor on MetricUnit.

The specs catch a named unit without English names or translation keys, and a unit that does not round-trip through MetricUnit.new and MetricUnit.In.

Types​

UnitId​

type UnitId = "microsecond" | "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" | "perSecond" | "perMinute" | "perHour" | "perDay" | "perWeek" | "perMonth" | "perYear" | "hertz" | "percent" | "permille" | "millimeter" | "centimeter" | "meter" | "kilometer" | "inch" | "foot" | "yard" | "mile" | "stud" | "squareMillimeter" | "squareCentimeter" | "squareMeter" | "hectare" | "squareKilometer" | "squareFoot" | "acre" | "milliliter" | "liter" | "cubicMeter" | "usFluidOunce" | "usGallon" | "imperialGallon" | "bit" | "kilobit" | "megabit" | "gigabit" | "byte" | "kilobyte" | "megabyte" | "gigabyte" | "kibibyte" | "mebibyte" | "gibibyte" | "bitPerSecond" | "kilobitPerSecond" | "megabitPerSecond" | "gigabitPerSecond" | "bytePerSecond" | "kilobytePerSecond" | "milligram" | "gram" | "kilogram" | "tonne" | "ounce" | "pound" | "stone" | "robloxMassUnit" | "meterPerSecond" | "kilometerPerHour" | "milePerHour" | "knot" | "studPerSecond" | "meterPerSecondSquared" | "studPerSecondSquared" | "newton" | "kilonewton" | "meganewton" | "poundForce" | "joule" | "kilojoule" | "megajoule" | "kilowattHour" | "kilocalorie" | "watt" | "kilowatt" | "megawatt" | "pascal" | "kilopascal" | "megapascal" | "bar" | "poundForcePerSquareInch" | "kilogramPerCubicMeter" | "gramPerCubicCentimeter" | "kelvin" | "celsius" | "fahrenheit" | "radian" | "degree" | "revolution" | "radianPerSecond" | "degreePerSecond" | "revolutionPerMinute" | "radianPerSecondSquared" | "microampere" | "milliampere" | "ampere" | "coulomb" | "millivolt" | "volt" | "kilovolt" | "ohm" | "kilohm" | "megohm" | "siemens" | "picofarad" | "nanofarad" | "microfarad" | "farad" | "microhenry" | "millihenry" | "henry" | "weber" | "millitesla" | "tesla" | "nanometer" | "micrometer" | "centiliter" | "deciliter" | "terabyte" | "petabyte" | "microgram" | "milliwatt" | "gigawatt" | "kilohertz" | "megahertz" | "gigahertz" | "becquerel" | "mole" | "millimole" | "micromole" | "kilomole" | "gramPerMole" | "molePerLiter" | "millimolePerLiter" | "katal" | "candela" | "steradian" | "lumen" | "lux" | "kilolux" | "gray" | "milligray" | "sievert" | "millisievert" | "microsievert" | "nauticalMile" | "literPer100Kilometers" | "squareInch" | "squareYard" | "squareMile" | "cubicInch" | "cubicFoot" | "cubicYard" | "usTeaspoon" | "usTablespoon" | "usCup" | "usPint" | "usQuart" | "imperialFluidOunce" | "imperialPint" | "imperialQuart" | "shortTon" | "footPerSecond" | "footPerSecondSquared" | "newtonMeter" | "britishThermalUnit" | "poundFoot" | "metricHorsepower" | "horsepower" | "inchOfMercury" | "poundPerCubicFoot" | "kilometerPerLiter" | "milePerUsGallon" | "milePerImperialGallon" | "rankine"

A unit's id: the singular, camelCase name of the unit. Every id has an entry in MetricUnitDefinitions; reading, formatting and MetricUnit.new all take it, so a typo is a type error.

UnitLike​

type UnitLike = UnitId | Time.TimeUnit | UnitDefinition

A unit id, any of @quenty/time's names for a time unit, such as "hours" or "h", or a unit itself, such as MINI:GetUnit("stud") from a MetricUnitSystem of the game's own scale.

UnitFamily​

type UnitFamily = string

The name of the MetricUnitSystem that declares a unit: "metric", "usCustomary", "imperial", "usCustomaryAndImperial" for the units the United States and Britain share (the inch, mile, pound, mph, BTU, horsepower), "roblox", or a game's own system. Time units and bare rates belong to none, since every system shares them.

UnitForms​

interface UnitForms {
one: string
other: string
}

A singular and plural form of a unit's English name or phrase.

UnitDefinition​

interface UnitDefinition {
id: UnitId
dimensions: Dimensions
factor: number
symbol: string
system: UnitFamily?
names: UnitForms?
shortTemplates: UnitForms?
aliases: {string}?
zero: number?
per: UnitId?
duration: boolean?
prefix: UnitPrefixOf?
}

One unit.

  • factor is its size in SI base units: seconds, metres, kilograms, bytes, kelvin, radians, amperes, moles or candelas, or their product for a derived unit, so a newton is 1 (kg·m/s²) and a kilowatt-hour 3,600,000 (J).
  • names is its American English name, for units written by name. Commonwealth spelling (metre, litre, tonne) is derived.
  • shortTemplates replaces the default short phrase, the symbol after a space, where that reads wrongly (45%, 45°, 1 stud). %s is the number.
  • duration marks the time units, which durations are written in.
  • prefix is set on a unit made from a prefix and another unit, such as kilometer.

The other fields are as in UnitRow.

UnitPrefixOf​

interface UnitPrefixOf {
name: string
base: UnitId
}

For a unit made by prefixing another, the prefix's name and the unit it prefixes: kilometer is kilo and meter. A translator writes it from those two when it has no entry for the unit itself.

UnitRow​

interface UnitRow {
id: UnitId
factor: number
symbol: string
name: string?
plural: string?
short: (string | UnitForms)?
aliases: {string}?
zero: number?
per: UnitId?
prefixes: PrefixSet?
elidesPrefixVowel: boolean?
}

One row of the list below, for a unit of the kind ("length", "speed") and system its define call gives.

  • factor is its size in SI base units.
  • name is its American English singular, for units written by name; plural defaults to name plus "s". Time units are written with @quenty/time's words and bare rates with per phrases, so they have none.
  • short replaces the symbol-after-a-space short phrase, as one template or a singular and plural.
  • aliases is other text it may be typed as when parsed, such as "kph".
  • zero is where the unit's scale starts, in base units. A unit with one is a scale whose readings are points: MetricUnit.new makes absolute values in it. Only the temperature scales have one.
  • per is the time unit a bare rate such as perHour counts per. Hertz is a rate too, but is written by name.
  • prefixes makes a unit for each prefix of a [PrefixSet]: meter with "si" makes kilometer, nanometer and the rest, with names, symbols and aliases from the unit's. A unit declared outright keeps its own row.
  • elidesPrefixVowel drops a prefix's final vowel before the unit, as SI writes kilohm and megohm.

Prefix​

interface Prefix {
name: string
symbol: string
factor: number
}

A metric or binary prefix: kilo is k and 1000.

PrefixSet​

type PrefixSet = "si" | "siMultiples" | "siMultiplesAndBinary"

Which prefixes a unit takes: "si" all twenty-four SI prefixes, "siMultiples" only those of 10 and above (no millibytes), and "siMultiplesAndBinary" those and the binary ones (KiB, MiB).

Properties​

ROBLOX_METERS_PER_STUD​

MetricUnitDefinitions.ROBLOX_METERS_PER_STUD: number

Metres in a Roblox stud, as Roblox documents it against the default avatar: 28 cm.

Functions​

getUnit​

MetricUnitDefinitions.getUnit(unit: UnitLike) → UnitDefinition?

The unit named unit, or nil. Takes any UnitLike, so "hours" and "h" find "hour", and a unit is returned as it is.

getPrefixedUnit​

MetricUnitDefinitions.getPrefixedUnit(
prefix: Prefix,
) → UnitDefinition?

The unit prefix makes of base, such as kilometer for kilo and meter, or nil when base does not take that prefix.

getDeclaredUnits​

MetricUnitDefinitions.getDeclaredUnits() → {UnitDefinition}

The units declared outright, without their prefixed forms, in the order declared. Cheaper than MetricUnitDefinitions.getUnits; MetricUnitDefinitions.getPrefixedUnit finds the rest.

getUnits​

MetricUnitDefinitions.getUnits() → {UnitDefinition}

Every unit, in the order declared, then every prefixed form. Building the prefixed forms costs a few milliseconds the first time, so look units up with MetricUnitDefinitions.getUnit where you can.

getUnitIds​

MetricUnitDefinitions.getUnitIds(dimensions: Dimensions) → {UnitId}

The ids of every unit of dimensions, in the order declared.

getPrefixes​

MetricUnitDefinitions.getPrefixes() → {Prefix}

Every prefix a unit can take: the twenty-four SI prefixes, smallest first, then the binary ones.

getTimeAliases​

MetricUnitDefinitions.getTimeAliases() → {[string]: UnitId}

@quenty/time's other names for its time units, such as "h" for "hour", mapped to unit ids.

isUnitDefinition​

MetricUnitDefinitions.isUnitDefinition(value: any) → boolean

Whether value is a UnitDefinition, such as one MetricUnitSystem.GetUnit returns.

createUnits​

MetricUnitDefinitions.createUnits(
kind: KindName,
system: string,--

the name of the system that declares them

rows: {UnitRow}
) → {UnitDefinition}

Units for a MetricUnitSystem of a game's own, from rows of one kind as in UnitRow, with their prefixed forms. They are not added to the well-known units; only a system holding them knows them.

local units = MetricUnitDefinitions.createUnits("length", "space", {
	{ id = "lightYear", factor = 9.4607e15, symbol = "ly", name = "light-year" },
})

createRobloxUnits​

MetricUnitDefinitions.createRobloxUnits(
system: string,--

the name of the system that declares them

metersPerStud: number
) → {UnitDefinition}

The Roblox units at a stud of metersPerStud: stud, studPerSecond, studPerSecondSquared and robloxMassUnit, a cubic stud of water, so it scales with the cube of the stud.

Show raw api
{
    "functions": [
        {
            "name": "getUnit",
            "desc": "The unit named `unit`, or nil. Takes any [UnitLike], so `\"hours\"` and `\"h\"` find `\"hour\"`, and a unit is\nreturned as it is.",
            "params": [
                {
                    "name": "unit",
                    "desc": "",
                    "lua_type": "UnitLike"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnitDefinition?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 899,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getPrefixedUnit",
            "desc": "The unit `prefix` makes of `base`, such as `kilometer` for `kilo` and `meter`, or nil when `base` does not take\nthat prefix.",
            "params": [
                {
                    "name": "prefix",
                    "desc": "",
                    "lua_type": "Prefix"
                },
                {
                    "name": "base",
                    "desc": "",
                    "lua_type": "UnitDefinition"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnitDefinition?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 915,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getDeclaredUnits",
            "desc": "The units declared outright, without their prefixed forms, in the order declared. Cheaper than\n[MetricUnitDefinitions.getUnits]; [MetricUnitDefinitions.getPrefixedUnit] finds the rest.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ UnitDefinition }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 937,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getUnits",
            "desc": "Every unit, in the order declared, then every prefixed form. Building the prefixed forms costs a few\nmilliseconds the first time, so look units up with [MetricUnitDefinitions.getUnit] where you can.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ UnitDefinition }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 947,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getUnitIds",
            "desc": "The ids of every unit of `dimensions`, in the order declared.",
            "params": [
                {
                    "name": "dimensions",
                    "desc": "",
                    "lua_type": "Dimensions"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ UnitId }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 974,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getPrefixes",
            "desc": "Every prefix a unit can take: the twenty-four SI prefixes, smallest first, then the binary ones.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Prefix }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 989,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "getTimeAliases",
            "desc": "`@quenty/time`'s other names for its time units, such as `\"h\"` for `\"hour\"`, mapped to unit ids.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: UnitId }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 998,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "isUnitDefinition",
            "desc": "Whether `value` is a [UnitDefinition], such as one [MetricUnitSystem.GetUnit] returns.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1008,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "createUnits",
            "desc": "Units for a [MetricUnitSystem] of a game's own, from rows of one kind as in [UnitRow], with their prefixed forms.\nThey are not added to the well-known units; only a system holding them knows them.\n\n```lua\nlocal units = MetricUnitDefinitions.createUnits(\"length\", \"space\", {\n\t{ id = \"lightYear\", factor = 9.4607e15, symbol = \"ly\", name = \"light-year\" },\n})\n```",
            "params": [
                {
                    "name": "kind",
                    "desc": "",
                    "lua_type": "KindName"
                },
                {
                    "name": "system",
                    "desc": "the name of the system that declares them",
                    "lua_type": "string"
                },
                {
                    "name": "rows",
                    "desc": "",
                    "lua_type": "{ UnitRow }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ UnitDefinition }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1031,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "createRobloxUnits",
            "desc": "The Roblox units at a stud of `metersPerStud`: `stud`, `studPerSecond`, `studPerSecondSquared` and\n`robloxMassUnit`, a cubic stud of water, so it scales with the cube of the stud.",
            "params": [
                {
                    "name": "system",
                    "desc": "the name of the system that declares them",
                    "lua_type": "string"
                },
                {
                    "name": "metersPerStud",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ UnitDefinition }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1071,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "ROBLOX_METERS_PER_STUD",
            "desc": "Metres in a Roblox stud, as Roblox documents it against the default avatar: 28 cm.",
            "lua_type": "number",
            "source": {
                "line": 384,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        }
    ],
    "types": [
        {
            "name": "UnitId",
            "desc": "A unit's id: the singular, camelCase name of the unit. Every id has an entry in [MetricUnitDefinitions]; reading,\nformatting and [MetricUnit.new] all take it, so a typo is a type error.",
            "lua_type": "\"microsecond\" | \"millisecond\" | \"second\" | \"minute\" | \"hour\" | \"day\" | \"week\" | \"month\" | \"quarter\" | \"year\" | \"perSecond\" | \"perMinute\" | \"perHour\" | \"perDay\" | \"perWeek\" | \"perMonth\" | \"perYear\" | \"hertz\" | \"percent\" | \"permille\" | \"millimeter\" | \"centimeter\" | \"meter\" | \"kilometer\" | \"inch\" | \"foot\" | \"yard\" | \"mile\" | \"stud\" | \"squareMillimeter\" | \"squareCentimeter\" | \"squareMeter\" | \"hectare\" | \"squareKilometer\" | \"squareFoot\" | \"acre\" | \"milliliter\" | \"liter\" | \"cubicMeter\" | \"usFluidOunce\" | \"usGallon\" | \"imperialGallon\" | \"bit\" | \"kilobit\" | \"megabit\" | \"gigabit\" | \"byte\" | \"kilobyte\" | \"megabyte\" | \"gigabyte\" | \"kibibyte\" | \"mebibyte\" | \"gibibyte\" | \"bitPerSecond\" | \"kilobitPerSecond\" | \"megabitPerSecond\" | \"gigabitPerSecond\" | \"bytePerSecond\" | \"kilobytePerSecond\" | \"milligram\" | \"gram\" | \"kilogram\" | \"tonne\" | \"ounce\" | \"pound\" | \"stone\" | \"robloxMassUnit\" | \"meterPerSecond\" | \"kilometerPerHour\" | \"milePerHour\" | \"knot\" | \"studPerSecond\" | \"meterPerSecondSquared\" | \"studPerSecondSquared\" | \"newton\" | \"kilonewton\" | \"meganewton\" | \"poundForce\" | \"joule\" | \"kilojoule\" | \"megajoule\" | \"kilowattHour\" | \"kilocalorie\" | \"watt\" | \"kilowatt\" | \"megawatt\" | \"pascal\" | \"kilopascal\" | \"megapascal\" | \"bar\" | \"poundForcePerSquareInch\" | \"kilogramPerCubicMeter\" | \"gramPerCubicCentimeter\" | \"kelvin\" | \"celsius\" | \"fahrenheit\" | \"radian\" | \"degree\" | \"revolution\" | \"radianPerSecond\" | \"degreePerSecond\" | \"revolutionPerMinute\" | \"radianPerSecondSquared\" | \"microampere\" | \"milliampere\" | \"ampere\" | \"coulomb\" | \"millivolt\" | \"volt\" | \"kilovolt\" | \"ohm\" | \"kilohm\" | \"megohm\" | \"siemens\" | \"picofarad\" | \"nanofarad\" | \"microfarad\" | \"farad\" | \"microhenry\" | \"millihenry\" | \"henry\" | \"weber\" | \"millitesla\" | \"tesla\" | \"nanometer\" | \"micrometer\" | \"centiliter\" | \"deciliter\" | \"terabyte\" | \"petabyte\" | \"microgram\" | \"milliwatt\" | \"gigawatt\" | \"kilohertz\" | \"megahertz\" | \"gigahertz\" | \"becquerel\" | \"mole\" | \"millimole\" | \"micromole\" | \"kilomole\" | \"gramPerMole\" | \"molePerLiter\" | \"millimolePerLiter\" | \"katal\" | \"candela\" | \"steradian\" | \"lumen\" | \"lux\" | \"kilolux\" | \"gray\" | \"milligray\" | \"sievert\" | \"millisievert\" | \"microsievert\" | \"nauticalMile\" | \"literPer100Kilometers\" | \"squareInch\" | \"squareYard\" | \"squareMile\" | \"cubicInch\" | \"cubicFoot\" | \"cubicYard\" | \"usTeaspoon\" | \"usTablespoon\" | \"usCup\" | \"usPint\" | \"usQuart\" | \"imperialFluidOunce\" | \"imperialPint\" | \"imperialQuart\" | \"shortTon\" | \"footPerSecond\" | \"footPerSecondSquared\" | \"newtonMeter\" | \"britishThermalUnit\" | \"poundFoot\" | \"metricHorsepower\" | \"horsepower\" | \"inchOfMercury\" | \"poundPerCubicFoot\" | \"kilometerPerLiter\" | \"milePerUsGallon\" | \"milePerImperialGallon\" | \"rankine\"",
            "source": {
                "line": 43,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitLike",
            "desc": "A unit id, any of `@quenty/time`'s names for a time unit, such as `\"hours\"` or `\"h\"`, or a unit itself, such as\n`MINI:GetUnit(\"stud\")` from a [MetricUnitSystem] of the game's own scale.",
            "lua_type": "UnitId | Time.TimeUnit | UnitDefinition",
            "source": {
                "line": 237,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitFamily",
            "desc": "The name of the [MetricUnitSystem] that declares a unit: `\"metric\"`, `\"usCustomary\"`, `\"imperial\"`,\n`\"usCustomaryAndImperial\"` for the units the United States and Britain share (the inch, mile, pound, mph, BTU,\nhorsepower), `\"roblox\"`, or a game's own system. Time units and bare rates belong to none, since every system\nshares them.",
            "lua_type": "string",
            "source": {
                "line": 248,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitForms",
            "desc": "A singular and plural form of a unit's English name or phrase.",
            "fields": [
                {
                    "name": "one",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "other",
                    "lua_type": "string",
                    "desc": ""
                }
            ],
            "source": {
                "line": 258,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitDefinition",
            "desc": "One unit.\n\n- `factor` is its size in SI base units: seconds, metres, kilograms, bytes, kelvin, radians, amperes, moles or\n  candelas, or their product for a derived unit, so a newton is 1 (kg·m/s²) and a kilowatt-hour 3,600,000 (J).\n- `names` is its American English name, for units written by name. Commonwealth spelling (metre, litre, tonne)\n  is derived.\n- `shortTemplates` replaces the default short phrase, the symbol after a space, where that reads wrongly\n  (`45%`, `45°`, `1 stud`). `%s` is the number.\n- `duration` marks the time units, which durations are written in.\n- `prefix` is set on a unit made from a prefix and another unit, such as `kilometer`.\n\nThe other fields are as in [UnitRow].",
            "fields": [
                {
                    "name": "id",
                    "lua_type": "UnitId",
                    "desc": ""
                },
                {
                    "name": "dimensions",
                    "lua_type": "Dimensions",
                    "desc": ""
                },
                {
                    "name": "factor",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "symbol",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "system",
                    "lua_type": "UnitFamily?",
                    "desc": ""
                },
                {
                    "name": "names",
                    "lua_type": "UnitForms?",
                    "desc": ""
                },
                {
                    "name": "shortTemplates",
                    "lua_type": "UnitForms?",
                    "desc": ""
                },
                {
                    "name": "aliases",
                    "lua_type": "{ string }?",
                    "desc": ""
                },
                {
                    "name": "zero",
                    "lua_type": "number?",
                    "desc": ""
                },
                {
                    "name": "per",
                    "lua_type": "UnitId?",
                    "desc": ""
                },
                {
                    "name": "duration",
                    "lua_type": "boolean?",
                    "desc": ""
                },
                {
                    "name": "prefix",
                    "lua_type": "UnitPrefixOf?",
                    "desc": ""
                }
            ],
            "source": {
                "line": 289,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitPrefixOf",
            "desc": "For a unit made by prefixing another, the prefix's name and the unit it prefixes: `kilometer` is `kilo` and\n`meter`. A translator writes it from those two when it has no entry for the unit itself.",
            "fields": [
                {
                    "name": "name",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "base",
                    "lua_type": "UnitId",
                    "desc": ""
                }
            ],
            "source": {
                "line": 313,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "UnitRow",
            "desc": "One row of the list below, for a unit of the kind (`\"length\"`, `\"speed\"`) and system its `define` call gives.\n\n- `factor` is its size in SI base units.\n- `name` is its American English singular, for units written by name; `plural` defaults to `name` plus \"s\".\n  Time units are written with `@quenty/time`'s words and bare rates with per phrases, so they have none.\n- `short` replaces the symbol-after-a-space short phrase, as one template or a singular and plural.\n- `aliases` is other text it may be typed as when parsed, such as `\"kph\"`.\n- `zero` is where the unit's scale starts, in base units. A unit with one is a scale whose readings are points:\n  [MetricUnit.new] makes absolute values in it. Only the temperature scales have one.\n- `per` is the time unit a bare rate such as `perHour` counts per. Hertz is a rate too, but is written by name.\n- `prefixes` makes a unit for each prefix of a [PrefixSet]: `meter` with `\"si\"` makes `kilometer`, `nanometer`\n  and the rest, with names, symbols and aliases from the unit's. A unit declared outright keeps its own row.\n- `elidesPrefixVowel` drops a prefix's final vowel before the unit, as SI writes `kilohm` and `megohm`.",
            "fields": [
                {
                    "name": "id",
                    "lua_type": "UnitId",
                    "desc": ""
                },
                {
                    "name": "factor",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "symbol",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "name",
                    "lua_type": "string?",
                    "desc": ""
                },
                {
                    "name": "plural",
                    "lua_type": "string?",
                    "desc": ""
                },
                {
                    "name": "short",
                    "lua_type": "(string | UnitForms)?",
                    "desc": ""
                },
                {
                    "name": "aliases",
                    "lua_type": "{ string }?",
                    "desc": ""
                },
                {
                    "name": "zero",
                    "lua_type": "number?",
                    "desc": ""
                },
                {
                    "name": "per",
                    "lua_type": "UnitId?",
                    "desc": ""
                },
                {
                    "name": "prefixes",
                    "lua_type": "PrefixSet?",
                    "desc": ""
                },
                {
                    "name": "elidesPrefixVowel",
                    "lua_type": "boolean?",
                    "desc": ""
                }
            ],
            "source": {
                "line": 344,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "Prefix",
            "desc": "A metric or binary prefix: `kilo` is `k` and 1000.",
            "fields": [
                {
                    "name": "name",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "symbol",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "factor",
                    "lua_type": "number",
                    "desc": ""
                }
            ],
            "source": {
                "line": 367,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        },
        {
            "name": "PrefixSet",
            "desc": "Which prefixes a unit takes: `\"si\"` all twenty-four SI prefixes, `\"siMultiples\"` only those of 10 and above (no\nmillibytes), and `\"siMultiplesAndBinary\"` those and the binary ones (`KiB`, `MiB`).",
            "lua_type": "\"si\" | \"siMultiples\" | \"siMultiplesAndBinary\"",
            "source": {
                "line": 376,
                "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
            }
        }
    ],
    "name": "MetricUnitDefinitions",
    "desc": "Every unit [MetricUnit] can be made in, read in, parsed from and written in. This list is where a unit is\ndeclared: its id, dimensions, size in SI base units, symbol, measurement system, English names and the other\ntext it may be typed as. [MetricUnit], [MetricUnitFormatUtils], [MetricUnitParseUtils] and\n[MetricUnitFallbackStrings] all read it. Symbols are the SI ones (or the customary ones for US and imperial\nunits), which do not change with the locale.\n\nTo add a unit:\n\n1. Add a row to the `define` call for its dimension and system below. See [UnitRow] for the fields. Give an SI\n   unit `prefixes` rather than adding its prefixed forms: `kilo`, `nano` and the rest are made from it.\n2. Add its id to the `UnitId` union, with any prefixed forms games commonly name. luau-lsp rejects a row whose\n   id is missing from it; other prefixed ids work at runtime.\n3. Add it to a system's display units in [MetricUnitSystems] if it should be picked by size.\n4. If it is written by name, add `units.<id>.long.<category>` and `units.<id>.short.<category>` for all six\n   plural categories to every `Localization/MetricUnitTranslator/<locale>.json.txt`: English from this row, the\n   other languages from CLDR's unit patterns. Prefixed forms need no entry; they are written from the\n   `prefixes` section and the unit's own entry.\n5. Only for a unit games construct constantly, add a named constructor on [MetricUnit].\n\nThe specs catch a named unit without English names or translation keys, and a unit that does not round-trip\nthrough [MetricUnit.new] and [MetricUnit.In].",
    "source": {
        "line": 27,
        "path": "src/metricutils/src/Shared/Definitions/MetricUnitDefinitions.lua"
    }
}