Skip to main content

Modifier

The modifier interface

This is for special game modifiers that change specific mechanics.

Modifier.add("FogOfWar")
if Modifier.check("FogOfWar") then
    Modifier.remove("FogOfWar")
end

Functions

check

Modifier.check(
idstring--

modifier identifier

) → boolean--

true if specified modifier is set

Return true if the modifier was added and false otherwise

add

Modifier.add(
idstring--

modifier identifier

) → boolean--

true if the modifier was not added before

Add the given modifier

remove

Modifier.remove(
idstring--

modifier identifier

) → boolean--

true if an modifier was removed

Remove the given modifier

clear

Modifier.clear() → ()

Clear all modifiers

Show raw api
{
    "functions": [
        {
            "name": "check",
            "desc": "Return true if the modifier was added and false otherwise",
            "params": [
                {
                    "name": "id",
                    "desc": "modifier identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if specified modifier is set",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 22,
                "path": "../../res/data/script/lib/system/modifier.lua"
            }
        },
        {
            "name": "add",
            "desc": "Add the given modifier",
            "params": [
                {
                    "name": "id",
                    "desc": "modifier identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if the modifier was not added before",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 32,
                "path": "../../res/data/script/lib/system/modifier.lua"
            }
        },
        {
            "name": "remove",
            "desc": "Remove the given modifier",
            "params": [
                {
                    "name": "id",
                    "desc": "modifier identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if an modifier was removed",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 42,
                "path": "../../res/data/script/lib/system/modifier.lua"
            }
        },
        {
            "name": "clear",
            "desc": "Clear all modifiers",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 50,
                "path": "../../res/data/script/lib/system/modifier.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Modifier",
    "desc": "The modifier interface\n\nThis is for special game modifiers that change specific mechanics.\n\n```lua\nModifier.add(\"FogOfWar\")\nif Modifier.check(\"FogOfWar\") then\n    Modifier.remove(\"FogOfWar\")\nend\n```",
    "source": {
        "line": 14,
        "path": "../../res/data/script/lib/system/modifier.lua"
    }
}