Skip to main content

WinCondition

Used to evaluate win conditions

Types

WinOutcome

interface WinOutcome {
Type(Player | Team | "Draw" | "None"),
Winners{Player | Team}
}

Functions

new

WinCondition.new(
namestring,
evaluator(contextContext) → (WinOutcome)
) → WinCondition

Constructor method for a new win condition

remove

WinCondition.remove(namestring) → ()

Removes a win condition from the registry

Resolve

WinCondition.Resolve(nameOrInstancestring | WinCondition) → WinCondition

Resolves a string name to a WinCondition instance or returns the provided instance

Evaluate

WinCondition:Evaluate(contextContext) → WinOutcome

Evaluates the win condition using the provided context

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructor method for a new win condition",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "evaluator",
                    "desc": "",
                    "lua_type": "(context: Context) -> (WinOutcome)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "WinCondition"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "src/Classes/WinCondition.lua"
            }
        },
        {
            "name": "remove",
            "desc": "Removes a win condition from the registry",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 26,
                "path": "src/Classes/WinCondition.lua"
            }
        },
        {
            "name": "Evaluate",
            "desc": "Evaluates the win condition using the provided context",
            "params": [
                {
                    "name": "context",
                    "desc": "",
                    "lua_type": "Context"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "WinOutcome"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 39,
                "path": "src/Classes/WinCondition.lua"
            }
        },
        {
            "name": "Resolve",
            "desc": "Resolves a string name to a WinCondition instance or returns the provided instance",
            "params": [
                {
                    "name": "nameOrInstance",
                    "desc": "",
                    "lua_type": "string | WinCondition"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "WinCondition"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 46,
                "path": "src/Classes/WinCondition.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "WinOutcome",
            "desc": "",
            "fields": [
                {
                    "name": "Type",
                    "lua_type": "(Player | Team | \"Draw\" | \"None\"),",
                    "desc": ""
                },
                {
                    "name": "Winners",
                    "lua_type": "{ Player | Team }",
                    "desc": ""
                }
            ],
            "source": {
                "line": 8,
                "path": "src/Types/WinOutcome.lua"
            }
        }
    ],
    "name": "WinCondition",
    "desc": "Used to evaluate win conditions",
    "source": {
        "line": 3,
        "path": "src/Classes/WinCondition.lua"
    }
}