Skip to main content

LinearValue

Represents a value that can operate in linear space

Properties

magnitude

This item is read only and cannot be modified. Read Only
LinearValue.magnitude: number

Returns the magnitude of the linear value.

Functions

new

LinearValue.new(
constructor(number...) → T,
values({number})
) → LinearValue<T>

Constructs a new LinearValue object.

isLinear

LinearValue.isLinear(
valueany--

A value to check

) → boolean--

True if a linear value, false otherwise

Returns whether or not a value is a LinearValue object.

toLinearIfNeeded

LinearValue.toLinearIfNeeded(valueT) → LinearValue<T> | T

Converts an arbitrary value to a LinearValue if Roblox has not defined this value for multiplication and addition.

fromLinearIfNeeded

LinearValue.fromLinearIfNeeded(valueLinearValue<T> | any) → T | any

Extracts the base value out of a packed linear value if needed.

ToBaseValue

LinearValue:ToBaseValue() → T

Converts the value back to the base value

GetMagnitude

LinearValue:GetMagnitude() → number--

The magnitude of the linear value.

Returns the magnitude of the linear value.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new LinearValue object.",
            "params": [
                {
                    "name": "constructor",
                    "desc": "",
                    "lua_type": "(number ...) -> T"
                },
                {
                    "name": "values",
                    "desc": "",
                    "lua_type": "({ number })"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "LinearValue<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 22,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        },
        {
            "name": "isLinear",
            "desc": "Returns whether or not a value is a LinearValue object.",
            "params": [
                {
                    "name": "value",
                    "desc": "A value to check",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "True if a linear value, false otherwise",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 35,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        },
        {
            "name": "toLinearIfNeeded",
            "desc": "Converts an arbitrary value to a LinearValue if Roblox has not defined this value\nfor multiplication and addition.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "LinearValue<T> | T"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 64,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        },
        {
            "name": "fromLinearIfNeeded",
            "desc": "Extracts the base value out of a packed linear value if needed.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "LinearValue<T> | any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T | any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 84,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        },
        {
            "name": "ToBaseValue",
            "desc": "Converts the value back to the base value",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "T"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 97,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        },
        {
            "name": "GetMagnitude",
            "desc": "Returns the magnitude of the linear value.",
            "params": [],
            "returns": [
                {
                    "desc": "The magnitude of the linear value.",
                    "lua_type": "number"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 142,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "magnitude",
            "desc": "Returns the magnitude of the linear value.",
            "lua_type": "number",
            "readonly": true,
            "source": {
                "line": 158,
                "path": "src/spring/src/Shared/LinearValue.lua"
            }
        }
    ],
    "types": [],
    "name": "LinearValue",
    "desc": "Represents a value that can operate in linear space",
    "source": {
        "line": 6,
        "path": "src/spring/src/Shared/LinearValue.lua"
    }
}