Skip to main content

Comparator

A pair of comparison operator and partial version, such as >=1.2. Forms one piece of a VersionReq.

Spec: https://docs.rs/semver/1.0.20/semver/struct.Comparator.html

Properties

op

This item is read only and cannot be modified. Read Only
Comparator.op: "=" | ">" | ">=" | "<" | "<=" | "~" | "^" | "*"

major

This item is read only and cannot be modified. Read Only
Comparator.major: number

minor

This item is read only and cannot be modified. Read Only
Comparator.minor: number?

patch

This item is read only and cannot be modified. Read Only
Comparator.patch: number?

pre

This item is read only and cannot be modified. Read Only
Comparator.pre: Prerelease

Functions

parse

Comparator.parse(inputstring) → Comparator

is

Comparator.is(objany) → boolean

Returns true if obj is a Comparator.

__eq

Comparator:__eq(otherComparator) → boolean

This metamethod tests for self and other values to be equal and is used by the operators == and ~=.

__tostring

Comparator:__tostring() → string

This metamethod transforms self into a string.

matches

Comparator:matches(verVersion) → boolean
Show raw api
{
    "functions": [
        {
            "name": "_parse_string_view",
            "desc": "",
            "params": [
                {
                    "name": "stringView",
                    "desc": "",
                    "lua_type": "StringView"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Comparator\n"
                }
            ],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 74,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "parse",
            "desc": "",
            "params": [
                {
                    "name": "input",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Comparator\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 131,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "is",
            "desc": "Returns `true` if `obj` is a [Comparator].",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 144,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "__eq",
            "desc": "This metamethod tests for `self` and `other` values to be equal and is used by the operators `==` and `~=`.",
            "params": [
                {
                    "name": "other",
                    "desc": "",
                    "lua_type": "Comparator"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 155,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "__tostring",
            "desc": "This metamethod transforms `self` into a string.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 169,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "matches",
            "desc": "",
            "params": [
                {
                    "name": "ver",
                    "desc": "",
                    "lua_type": "Version"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 339,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "op",
            "desc": "",
            "lua_type": "\"=\" | \">\" | \">=\" | \"<\" | \"<=\" | \"~\" | \"^\" | \"*\"",
            "readonly": true,
            "source": {
                "line": 50,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "major",
            "desc": "",
            "lua_type": "number",
            "readonly": true,
            "source": {
                "line": 54,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "minor",
            "desc": "",
            "lua_type": "number?",
            "readonly": true,
            "source": {
                "line": 58,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "patch",
            "desc": "",
            "lua_type": "number?",
            "readonly": true,
            "source": {
                "line": 62,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        },
        {
            "name": "pre",
            "desc": "",
            "lua_type": "Prerelease",
            "readonly": true,
            "source": {
                "line": 66,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        }
    ],
    "types": [
        {
            "name": "StringView",
            "desc": "",
            "lua_type": "{cursor: number, str: string, pos: string}",
            "private": true,
            "source": {
                "line": 70,
                "path": "lib/CargoSemver/src/Comparator.luau"
            }
        }
    ],
    "name": "Comparator",
    "desc": "A pair of comparison operator and partial version, such as `>=1.2`. Forms one piece of a [VersionReq].\n\nSpec: https://docs.rs/semver/1.0.20/semver/struct.Comparator.html",
    "source": {
        "line": 42,
        "path": "lib/CargoSemver/src/Comparator.luau"
    }
}