Skip to main content

PointsUtil

Utility for points

Functions​

getPointInstances​

PointsUtil.getPointInstances(instance: Instance) → Result<{Instance},PointInstancesResult>

Types

​

interface PointInstancesResult {
startIndex: number
endIndex: number
duplicatePoints: {number}
invalidIndexes: {number}
missingPoints: {number}
}

Converts an Instance's children into an array of Instances Instances must be named in order starting from either 0 or 1

getPoints​

PointsUtil.getPoints(
pointInstances: {Instance},
getData: (instance: Instance) → T
) → Result<{T},{PointIndexError}>

Types

​

interface PointIndexError {
name: string
error: string
}

Converts a array of Instances into an array of CFrames

getCFrameFromPoints​

PointsUtil.getCFrameFromPoints(instance: Instance) → Result<{CFrame},string>

Gets Points (a list of CFrame positions in order) from an Instance

Errors

TypeDescription
"Could not get points!"Something went wrong when getting an ordered list of points
"Could not convert all points to CFrames!"A point Instance could not be converted to a CFrame. See `getCFrameFromInstance` for valid Instances
Show raw api
{
    "functions": [
        {
            "name": "getPointInstances",
            "desc": "Converts an Instance's children into an array of Instances\nInstances must be named in order starting from either 0 or 1",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<{Instance}, PointInstancesResult>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 46,
                "path": "src/shared/cframeTrack/util/pointsUtil.lua"
            }
        },
        {
            "name": "getPoints",
            "desc": "Converts a array of Instances into an array of CFrames",
            "params": [
                {
                    "name": "pointInstances",
                    "desc": "",
                    "lua_type": "{Instance}"
                },
                {
                    "name": "getData",
                    "desc": "",
                    "lua_type": "(instance: Instance) -> T"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<{T}, {PointIndexError}>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 147,
                "path": "src/shared/cframeTrack/util/pointsUtil.lua"
            }
        },
        {
            "name": "getCFrameFromPoints",
            "desc": "Gets Points (a list of CFrame positions in order) from an Instance",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Result<{CFrame}, string>"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "\"Could not get points!\"",
                    "desc": "Something went wrong when getting an ordered list of points"
                },
                {
                    "lua_type": "\"Could not convert all points to CFrames!\"",
                    "desc": "A point Instance could not be converted to a CFrame. See `getCFrameFromInstance` for valid Instances"
                }
            ],
            "source": {
                "line": 178,
                "path": "src/shared/cframeTrack/util/pointsUtil.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "PointInstancesResult",
            "desc": "",
            "fields": [
                {
                    "name": "startIndex",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "endIndex",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "duplicatePoints",
                    "lua_type": "{number}",
                    "desc": ""
                },
                {
                    "name": "invalidIndexes",
                    "lua_type": "{number}",
                    "desc": ""
                },
                {
                    "name": "missingPoints",
                    "lua_type": "{number}",
                    "desc": ""
                }
            ],
            "source": {
                "line": 19,
                "path": "src/shared/cframeTrack/util/pointsUtil.lua"
            }
        },
        {
            "name": "PointIndexError",
            "desc": "",
            "fields": [
                {
                    "name": "name",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "error",
                    "lua_type": "string",
                    "desc": ""
                }
            ],
            "source": {
                "line": 121,
                "path": "src/shared/cframeTrack/util/pointsUtil.lua"
            }
        }
    ],
    "name": "PointsUtil",
    "desc": "Utility for points",
    "source": {
        "line": 11,
        "path": "src/shared/cframeTrack/util/pointsUtil.lua"
    }
}