Show raw api
{
"functions": [
{
"name": "new",
"desc": "`amount` of the unit `unit`: the constructor for every unit. The common ones also have their own, such as\n[MetricUnit.meters]; the rest, and units chosen at runtime, use this. A temperature scale gives an absolute\ntemperature, as [MetricUnit.celsius] does.\n\n```lua\nMetricUnit.new(5, \"kilometer\") == MetricUnit.kilometers(5) -- true\nMetricUnit.new(90, \"minutes\") == MetricUnit.hours(1.5) -- true\nMetricUnit.new(60, \"milePerHour\")\n```",
"params": [
{
"name": "amount",
"desc": "",
"lua_type": "number"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitLike"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 137,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "point",
"desc": "A point `amount` of `unit` from that unit's zero: a reading on a scale rather than a change along it. A unit's zero\nis where its scale starts, such as -273.15 °C for kelvin, and is 0 for every unit but the temperature scales; time\nunits count from an epoch the caller chooses, as [MetricUnit.instant] does.\n\n```lua\nMetricUnit.point(20, \"celsius\") == MetricUnit.celsius(20) -- true\nMetricUnit.point(90, \"second\") == MetricUnit.instant(90) -- true\n```",
"params": [
{
"name": "amount",
"desc": "",
"lua_type": "number"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitLike"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 154,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "difference",
"desc": "A difference of `amount` of `unit`: a change along a scale rather than a reading on it. Most units already make\ndifferences with [MetricUnit.new]; this is for the temperature scales, whose readings are points.\n\n```lua\nMetricUnit.difference(12, \"celsius\"):In(\"kelvin\") -- 12\nMetricUnit.difference(9, \"fahrenheit\"):In(\"kelvin\") -- 5\n(MetricUnit.celsius(15) + MetricUnit.difference(12, \"celsius\")):In(\"celsius\") -- 27\n```",
"params": [
{
"name": "amount",
"desc": "",
"lua_type": "number"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitLike"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 177,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "none",
"desc": "A dimensionless value.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 192,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "milliseconds",
"desc": "`n` milliseconds.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 203,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "seconds",
"desc": "`n` seconds.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 213,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "minutes",
"desc": "`n` minutes.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 223,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "hours",
"desc": "`n` hours.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 233,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "days",
"desc": "`n` days of 24 hours.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 243,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "weeks",
"desc": "`n` weeks of seven days.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 253,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "months",
"desc": "`n` averaged months, each exactly a twelfth of an averaged year. For calendar months, use `Time.add`.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 263,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "years",
"desc": "`n` averaged years of 365.25 days (a Julian year), for long-range elapsed time. For calendar years, use `Time.add`.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 273,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "perSecond",
"desc": "`n` times a second.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 283,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "perHour",
"desc": "`n` times an hour.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 293,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "perDay",
"desc": "`n` times a day.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 303,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "perYear",
"desc": "`n` times a year.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 313,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "millimeters",
"desc": "`n` millimetres.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 323,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "meters",
"desc": "`n` metres.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 333,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "kilometers",
"desc": "`n` kilometres.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 343,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "studs",
"desc": "`n` Roblox studs, 28 cm each, as Roblox measures them against the default avatar. For studs at a game's own\nscale, use its system: `MINI:New(n, \"stud\")`.\n\n```lua\nMetricUnit.studs(10):In(\"meter\") -- 2.8\n```",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 358,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "squareKilometers",
"desc": "`n` square kilometres.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 367,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "grams",
"desc": "`n` grams.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 377,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "kilograms",
"desc": "`n` kilograms.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 387,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "tonnes",
"desc": "`n` tonnes of 1,000 kg.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 397,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "bytes",
"desc": "`n` bytes.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 407,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "kilobytes",
"desc": "`n` kilobytes of 1,000 bytes.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 417,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "megabytes",
"desc": "`n` megabytes of 1,000,000 bytes.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 427,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "degrees",
"desc": "`n` degrees, a 360th of a revolution.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 437,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "radians",
"desc": "`n` radians, the unit `CFrame.Angles` and `math.sin` take.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 447,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "percent",
"desc": "`n` percent, a hundredth each: `percent(45)` is 0.45.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 457,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "kelvin",
"desc": "The absolute temperature `n` kelvin.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 467,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "celsius",
"desc": "The absolute temperature `n` °C.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 477,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "fahrenheit",
"desc": "The absolute temperature `n` °F.",
"params": [
{
"name": "n",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 487,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "instant",
"desc": "The instant `seconds` after an epoch: a point in time rather than a span of it. The epoch is whatever the caller\nmeasures from, such as a simulation's start; [MetricUnit.fromDateTime] uses the Unix epoch. Instants follow the\nsame rules as absolute temperatures: two subtract to a span, an instant and a span add to an instant, and an\ninstant cannot be added to another, scaled or negated. Instants from different epochs must not be mixed; nothing\ncan check that for you.\n\n```lua\nlocal worldStart = MetricUnit.instant(0)\nlocal now = worldStart + MetricUnit.years(250)\n(now - worldStart):In(\"year\") -- 250\nnow:In(\"year\") -- 250, time since its epoch\n```",
"params": [
{
"name": "seconds",
"desc": "since the epoch",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 508,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "fromDateTime",
"desc": "The instant `dateTime` marks, measured from the Unix epoch, to the millisecond. Subtract two for the exact time\nbetween them, which counts calendar months and leap days at their real length.\n\n```lua\nlocal played = MetricUnit.fromDateTime(DateTime.now()) - MetricUnit.fromDateTime(joinedAt)\n```",
"params": [
{
"name": "dateTime",
"desc": "",
"lua_type": "DateTime"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 524,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "fromStudVelocity",
"desc": "The speed of a Roblox velocity, such as `part.AssemblyLinearVelocity`, in studs per second by its magnitude. The\nvalue converts to metric through the stud like any other: read it with `:In(\"kilometerPerHour\")`.",
"params": [
{
"name": "velocity",
"desc": "in studs per second",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 538,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "parse",
"desc": "Reads `text` such as `\"5 km\"`, `\"2.5 kilometers\"`, `\"1h30m\"`, `\"1:30:00\"`, `\"20 °C\"`, `\"60 mph\"` or `\"5 m/s\"`,\nfor commands, admin tools, configs and text boxes. Returns nil and a message to show instead of erroring. See\n[MetricUnitParseUtils.parse] for the grammar and how `kind` resolves ambiguous text such as `\"m\"`.\n\n```lua\nlocal reach, err = MetricUnit.parse(textBox.Text, \"length\")\nif not reach then\n\twarn(err)\nend\n```",
"params": [
{
"name": "text",
"desc": "",
"lua_type": "string"
},
{
"name": "kind",
"desc": "",
"lua_type": "(KindName | Dimensions)?"
},
{
"name": "options",
"desc": "",
"lua_type": "ParseOptions?"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit?"
},
{
"desc": "why it could not be read",
"lua_type": "string?"
}
],
"function_type": "static",
"source": {
"line": 562,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "isUnit",
"desc": "Whether `value` is a [MetricUnit].",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "any"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 590,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "isKind",
"desc": "Whether `value` is a [MetricUnit] of `kind`, a [KindName] or a table of exponents. Safe to call on anything.\nErrors on an unknown name, so a typo does not quietly answer false.\n\n```lua\nMetricUnit.isKind(MetricUnit.kilometers(1) / MetricUnit.hours(1), \"speed\") -- true\nMetricUnit.isKind(MetricUnit.celsius(5), \"temperature\") -- true, absolute\nMetricUnit.isKind(MetricUnit.difference(5, \"celsius\"), \"temperatureDifference\") -- true\nMetricUnit.isKind(5, \"length\") -- false\n```",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "any"
},
{
"name": "kind",
"desc": "",
"lua_type": "KindName | Dimensions"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 609,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "sameDimension",
"desc": "Whether `a` and `b` have the same dimensions; a plain 0 has every dimension and any other number none.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 623,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "expect",
"desc": "The amount of `value` in SI base units, for checking arguments at an API boundary. Errors with `slot`, the\ndimension expected and the one given if `value` is not of `kind`. A plain 0 is zero of any kind but an absolute\none.\n\n```lua\nlocal function setReach(reach: MetricUnit.MetricUnit | number)\n\tlocal meters = MetricUnit.expect(reach, \"length\", \"reach\")\nend\n```",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "kind",
"desc": "",
"lua_type": "KindName | Dimensions"
},
{
"name": "slot",
"desc": "what the value is for, used in the error",
"lua_type": "string"
}
],
"returns": [
{
"desc": "in SI base units",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 646,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "isZero",
"desc": "Whether `value` is zero.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 696,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "sign",
"desc": "-1, 0 or 1 as `value` is negative, zero or positive; an absolute temperature is measured from absolute zero.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 710,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "In",
"desc": "How many of `unit` this is. `unit` is a unit id, any of `@quenty/time`'s names for a time unit, or another\n[MetricUnit] to take the ratio with. Errors, naming both dimensions, when they differ.\n\nA point reads from the unit's zero, so a temperature reads on its scale and an instant as the time since its\nepoch; a difference reads as it is. Rates read per a time unit with the `per` ids.\n\n```lua\nMetricUnit.kilometers(2):In(\"meter\") -- 2000\nMetricUnit.minutes(90):In(\"hours\") -- 1.5\nMetricUnit.perDay(48):In(\"perHour\") -- 2\nMetricUnit.celsius(100):In(\"fahrenheit\") -- 212\n(MetricUnit.meters(10) / MetricUnit.seconds(1)):In(MetricUnit.kilometers(1) / MetricUnit.hours(1)) -- 36\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitLike | MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 736,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "InSeconds",
"desc": "This time in exact seconds, the same as `:In(\"second\")`: the number to hand to `task.wait`, `os.time` arithmetic\nor `TimeDurationUtils`.\n\n```lua\ntask.wait(MetricUnit.minutes(2):InSeconds())\nTimeDurationUtils.format(MetricUnit.hours(36):InSeconds(), \"h:mm\") --> 36:00\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 774,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ToDateTime",
"desc": "This instant as a `DateTime`, to the nearest millisecond, taking its epoch to be the Unix epoch as\n[MetricUnit.fromDateTime] does. Errors on anything but an instant. To move a date by exact time, add a span:\n`(MetricUnit.fromDateTime(dateTime) + MetricUnit.days(7)):ToDateTime()`. To move by calendar months, use\n`Time.add` from `@quenty/time`.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "DateTime"
}
],
"function_type": "static",
"source": {
"line": 787,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetBaseAmount",
"desc": "This value's amount in SI base units: seconds, metres, kilograms, bytes, kelvin, or their products.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 807,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetDimensions",
"desc": "This value's frozen dimension exponents, such as `{ length = 1, time = -1 }` for a speed.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "Dimensions"
}
],
"function_type": "static",
"source": {
"line": 816,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetKind",
"desc": "What this value measures, such as `\"length\"`, `\"speed\"` or `\"temperature\"`, or nil for a compound without a\nname, such as length to the fourth.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "KindName?"
}
],
"function_type": "static",
"source": {
"line": 826,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "IsKind",
"desc": "Whether this value is of `kind`, a [KindName] or a table of exponents.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "kind",
"desc": "",
"lua_type": "KindName | Dimensions"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 836,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "IsAbsolute",
"desc": "Whether this value is absolute, a point on a scale such as a temperature, rather than a difference.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 845,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetUnitIds",
"desc": "The ids of every unit this value can be read in or formatted as, for a settings menu to offer. Metric units come\nfirst, then US customary ones, then Roblox studs.\n\n```lua\nMetricUnit.meters(1):GetUnitIds() -- { \"millimeter\", \"centimeter\", \"meter\", \"kilometer\", \"inch\", ... }\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "{ UnitId }"
}
],
"function_type": "static",
"source": {
"line": 859,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ToUSCustomary",
"desc": "This value, preferring United States customary units when it is formatted: miles, feet and inches; US gallons,\nquarts and cups; short tons, pounds and ounces; mph, mpg (US), BTU, horsepower, psi and °F where its dimension\nhas them, and metric units elsewhere. The amount is unchanged, so arithmetic, comparison, [MetricUnit.In] and\nsaving behave exactly as before. A locale never chooses these units, not even `en-us`: call this from a\nplayer's setting.\n\n```lua\nMetricUnit.format(MetricUnit.kilometers(5):ToUSCustomary()) --> 3.107 mi\nMetricUnit.format(MetricUnit.new(2, \"liter\"):ToUSCustomary()) --> 2.113 qt\nlocal shown = if settings.useImperial then distance:ToUSCustomary() else distance\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 878,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ToImperial",
"desc": "This value, preferring British imperial units when it is formatted: imperial gallons, pints and fluid ounces;\nstone, pounds and ounces; mpg (UK); and the units Britain shares with the United States (miles, mph, BTU,\nhorsepower, psi, °F). The amount is unchanged. See [MetricUnit.ToUSCustomary] for US units.\n\n```lua\nMetricUnit.format(MetricUnit.new(2, \"liter\"):ToImperial()) --> 3.52 imp pt\nMetricUnit.format(MetricUnit.kilograms(80):ToImperial()) --> 12.598 st\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 893,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ToMetric",
"desc": "This value, preferring metric units when it is formatted. Metric is already the default; this clears a US\ncustomary or imperial preference or a pinned unit.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 902,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ToSystem",
"desc": "This value, preferring `system`'s units when it is formatted. The amount is unchanged, so arithmetic,\ncomparison, [MetricUnit.In] and saving behave exactly as before. [MetricUnit.ToUSCustomary],\n[MetricUnit.ToImperial] and [MetricUnit.ToMetric] are this with the well-known systems.\n\n```lua\nMetricUnit.format(MetricUnit.meters(0.14):ToSystem(MINI)) --> 5 studs, in a game's own system\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "system",
"desc": "",
"lua_type": "MetricUnitSystem"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 918,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "As",
"desc": "This value, always formatted in `unit`, which must measure the same thing. The amount is unchanged.\n\n```lua\nMetricUnit.format(MetricUnit.kilometers(5):As(\"mile\")) --> 3.107 mi\nMetricUnit.format(MetricUnit.meters(28):As(\"stud\")) --> 100 studs\nMetricUnit.format(height:As(MINI:GetUnit(\"stud\"))) --> a game's own stud\n```",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitLike"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 937,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetDisplaySystem",
"desc": "The system this value prefers to be formatted in, from [MetricUnit.ToSystem] or [MetricUnit.As], or nil for the\ndefault (metric). A display concern only: it is not saved by [MetricUnit.toData] and never affects arithmetic.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnitSystem?"
}
],
"function_type": "static",
"source": {
"line": 966,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "GetDisplayUnit",
"desc": "The unit this value is always formatted in, from [MetricUnit.As], or nil.",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "UnitDefinition?"
}
],
"function_type": "static",
"source": {
"line": 976,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "format",
"desc": "Text for players, localized, in a unit that suits the size. See [MetricUnitFormatUtils.format] for the options.\nAn instant is written as the time since its epoch, since only the caller knows what the epoch is; for a calendar\ndate, use `Time.format(x:ToDateTime(), ...)` from `@quenty/time`.\n\n```lua\nMetricUnit.format(MetricUnit.meters(2500)) --> 2.5 km\nMetricUnit.format(MetricUnit.meters(2500), { unitDisplay = \"long\", locale = \"en-gb\" }) --> 2.5 kilometres\nMetricUnit.format(MetricUnit.new(90, \"kilometerPerHour\"), { unit = \"kilometerPerHour\" }) --> 90 km/h\nMetricUnit.format(MetricUnit.kilometers(5):ToUSCustomary()) --> 3.107 mi\nMetricUnit.format(MetricUnit.years(1)) --> 1 year\nMetricUnit.format(MetricUnit.minutes(90), { locale = \"es-es\" }) --> 1 hora, 30 minutos\n```",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "options",
"desc": "",
"lua_type": "FormatOptions?"
}
],
"returns": [
{
"desc": "",
"lua_type": "string"
}
],
"function_type": "static",
"source": {
"line": 999,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "toData",
"desc": "`value` as plain data, for saves.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnitData"
}
],
"function_type": "static",
"source": {
"line": 1010,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "fromData",
"desc": "The [MetricUnit] that `data` from [MetricUnit.toData] holds.",
"params": [
{
"name": "data",
"desc": "",
"lua_type": "MetricUnitData"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1025,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "abs",
"desc": "The size of `value`, a difference.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1042,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "sqrt",
"desc": "The square root of `value`, halving its exponents, erroring if any is odd.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1054,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "pow",
"desc": "`value` to the whole power `power`, multiplying its exponents.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "power",
"desc": "a whole number",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1078,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "round",
"desc": "`value` rounded to a whole number of `step`, halves rounding up. `step` is a unit id, such as `\"minute\"`, or a\nvalue to snap to a multiple of. A temperature rounds on its own scale (`round(celsius(21.6), \"celsius\")` is\n22 °C) and an instant rounds from its epoch.\n\n```lua\nMetricUnit.round(MetricUnit.seconds(95), \"minute\") -- 2 minutes\nMetricUnit.round(MetricUnit.meters(12.4), MetricUnit.meters(5)) -- 10 m\n```",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "step",
"desc": "",
"lua_type": "UnitLike | MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1106,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "floor",
"desc": "`value` rounded down to a whole number of `step`. See [MetricUnit.round].",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "step",
"desc": "",
"lua_type": "UnitLike | MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1119,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "ceil",
"desc": "`value` rounded up to a whole number of `step`. See [MetricUnit.round].",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "step",
"desc": "",
"lua_type": "UnitLike | MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1130,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "min",
"desc": "The smallest of `...`, all of one dimension.",
"params": [
{
"name": "...",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1140,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "max",
"desc": "The largest of `...`, all of one dimension.",
"params": [
{
"name": "...",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1150,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "clamp",
"desc": "`value` held between `low` and `high`, all of one dimension.",
"params": [
{
"name": "value",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "low",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "high",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1162,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "lerp",
"desc": "The value `t` of the way from `a` to `b`, of one dimension, for animation. Follows the absolute/difference rules,\nso lerping two temperatures or two instants gives a temperature or an instant.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "t",
"desc": "0 gives `a`, 1 gives `b`",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1175,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "sum",
"desc": "The sum of `values`, all of one dimension. Absolutes cannot be summed, as with `+`.",
"params": [
{
"name": "values",
"desc": "",
"lua_type": "{ MetricUnit | number }"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1188,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "mean",
"desc": "The mean of `values`, all of one dimension. Absolutes average too: the mean of two temperatures is the\ntemperature halfway between them. For the smallest or largest of a list, use\n`MetricUnit.min(table.unpack(values))`.",
"params": [
{
"name": "values",
"desc": "",
"lua_type": "{ MetricUnit | number }"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1210,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "fuzzyEq",
"desc": "Whether `a` and `b`, of one dimension, are within `epsilon` of each other. `epsilon` is a [MetricUnit] of their\ndimension, or a plain number in SI base units (1e-9 by default).",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "epsilon",
"desc": "",
"lua_type": "(MetricUnit | number)?"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 1235,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "arcLength",
"desc": "The length an angle sweeps along a circle of `radius`, or, for an angular velocity, the speed along it.\nAngles never mix with lengths on their own, so this is the one place they meet.\n\n```lua\nMetricUnit.arcLength(MetricUnit.degrees(180), MetricUnit.meters(2)):In(\"meter\") -- 6.283\nMetricUnit.arcLength(MetricUnit.new(60, \"revolutionPerMinute\"), MetricUnit.meters(1)):In(\"meterPerSecond\") -- 6.283\n```",
"params": [
{
"name": "angular",
"desc": "an angle, or an angle per time",
"lua_type": "MetricUnit"
},
{
"name": "radius",
"desc": "a length",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1261,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__add",
"desc": "The sum of two values of one dimension; an absolute and a difference give an absolute.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1294,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__sub",
"desc": "The difference of two values of one dimension; two absolutes give a difference.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1316,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__mul",
"desc": "The product, combining dimensions; a plain number scales.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1339,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__div",
"desc": "The quotient, combining dimensions; a plain number scales, or over a unit inverts it.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit | number"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit | number"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1358,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__unm",
"desc": "The negation of a difference.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "MetricUnit"
}
],
"function_type": "static",
"source": {
"line": 1376,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__eq",
"desc": "Whether `a` equals `b`, both of one kind.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 1388,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__lt",
"desc": "Whether `a` is less than `b`, both of one kind.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 1400,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__le",
"desc": "Whether `a` is at most `b`, both of one kind.",
"params": [
{
"name": "a",
"desc": "",
"lua_type": "MetricUnit"
},
{
"name": "b",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 1412,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "__tostring",
"desc": "[MetricUnit.format] in English with four significant digits, the same in every locale, for logs and test failures.\nAn instant is written as its time since the epoch, such as \"epoch + 1 minute, 30 seconds\".",
"params": [
{
"name": "self",
"desc": "",
"lua_type": "MetricUnit"
}
],
"returns": [
{
"desc": "",
"lua_type": "string"
}
],
"function_type": "static",
"source": {
"line": 1423,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
}
],
"properties": [],
"types": [
{
"name": "UnitId",
"desc": "See [MetricUnitDefinitions.UnitId].",
"lua_type": "MetricUnitDefinitions.UnitId",
"source": {
"line": 83,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "UnitLike",
"desc": "See [MetricUnitDefinitions.UnitLike].",
"lua_type": "MetricUnitDefinitions.UnitLike",
"source": {
"line": 91,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "FormatOptions",
"desc": "See [MetricUnitFormatUtils.MetricUnitFormatOptions].",
"lua_type": "MetricUnitFormatUtils.MetricUnitFormatOptions",
"source": {
"line": 99,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
},
{
"name": "MetricUnitData",
"desc": "See [MetricUnitFormatUtils.MetricUnitData].",
"lua_type": "MetricUnitFormatUtils.MetricUnitData",
"source": {
"line": 107,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
}
],
"name": "MetricUnit",
"desc": "A measurement that knows what it measures: an amount in SI base units with integer exponents for each dimension.\nTime is held in seconds, length in metres, mass in kilograms, memory in bytes, temperature in kelvin, angle in\nradians, current in amperes, amount of substance in moles and luminous intensity in candelas: the SI base units,\nwith bytes and radians added. Derived\nquantities such as speed, force, energy and power are products of those, so `MetricUnit.new(1, \"newton\")` and\n`MetricUnit.kilograms(1) * MetricUnit.meters(1) / MetricUnit.pow(MetricUnit.seconds(1), 2)` are the same value.\n\nEvery unit has one id, such as `\"kilometer\"`, used to read and write it, and one constructor, such as\n[MetricUnit.kilometers]. Read a value in any unit of its dimension with [MetricUnit.In].\n\nValues are frozen, and every operation returns a new one. `*` and `/` combine dimensions, a plain number scales,\nand `+`, `-`, `<`, `<=` and `==` need the same dimension on both sides. A plain `0` is zero of whatever dimension it\nmeets in `+`, `-` and the helpers; any other plain number is dimensionless.\n\nA value is either a difference, which scales and adds freely, or absolute, a point on a scale such as a\ntemperature in °C or an instant in time. [MetricUnit.new] makes points on the temperature scales and differences\nin every other unit; [MetricUnit.point] and [MetricUnit.difference] make either in any unit. Two absolutes subtract to a difference, an absolute and a difference add to an\nabsolute, and an absolute cannot be added to another, negated, multiplied or divided, kelvin included.\n\n```lua\nlocal speed = MetricUnit.kilometers(36) / MetricUnit.hours(1)\nspeed:In(\"meterPerSecond\") -- 10\nspeed:In(\"milePerHour\") -- 22.37\nspeed:GetKind() -- \"speed\"\nMetricUnit.format(speed) -- \"10 m/s\"\n\nlocal power = MetricUnit.new(3, \"kilowattHour\") / MetricUnit.hours(1)\npower:In(\"kilowatt\") -- 3\n\nlocal reach = MetricUnit.expect(MetricUnit.studs(100), \"length\", \"reach\") -- 28, in metres\n\nlocal swing = MetricUnit.difference(12, \"celsius\")\n(MetricUnit.celsius(15) + swing):In(\"celsius\") -- 27\n(MetricUnit.celsius(15) - MetricUnit.celsius(10)):In(\"kelvin\") -- 5\n```\n\nTime is elapsed time in exact seconds. [MetricUnit.years] and [MetricUnit.months] are averages for long-range math\n(a Julian year of 365.25 days, and a twelfth of it), not calendar spans; move a date by calendar months with\n`Time.add` from `@quenty/time`. [MetricUnit.InSeconds] hands exact seconds to `task.wait`, `os.time` and\n`TimeDurationUtils`. [MetricUnit.instant] makes a point in time on any epoch, and [MetricUnit.fromDateTime] and\n[MetricUnit.ToDateTime] cross to and from `DateTime`.\n\n[MetricUnit.format] writes a value for players, localized, and [MetricUnit.parse] reads one back. A value is\nwritten in the system of the unit it was made from (miles stay miles, studs stay studs), and metric when made\nfrom a metric unit. Convert it ([MetricUnit.ToMetric], [MetricUnit.ToImperial]) or pin one unit\n([MetricUnit.As]) to write it otherwise; the locale never chooses. `tostring` is a fixed English debug string.\n\nLuau cannot compare a table with a number, so `x < 0` and `x == 0` do not work; use [MetricUnit.sign] and\n[MetricUnit.isZero].",
"source": {
"line": 55,
"path": "src/metricutils/src/Shared/MetricUnit.lua"
}
}