Skip to main content

Unlock

The unlock interface

Unlock.add("rogue")
if Unlock.check("rogue") then
    Unlock.remove("rogue")
end

Functions

check

Unlock.check(
idstring--

unlock identifier

) → boolean--

true if specified unlock is set

Return true if the unlock was added and false otherwise

add

Unlock.add(
idstring--

unlock identifier

) → boolean--

true if the unlock was not added before

Add the given unlock to the user save

remove

Unlock.remove(
idstring--

unlock identifier

) → boolean--

true if an unlock was removed

Remove the given unlock from the current user save

clear

Unlock.clear() → boolean--

true if any unlock was removed

Clear all unlocks from the current user save

Show raw api
{
    "functions": [
        {
            "name": "check",
            "desc": "Return true if the unlock was added and false otherwise",
            "params": [
                {
                    "name": "id",
                    "desc": "unlock identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if specified unlock is set",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 20,
                "path": "../../res/data/script/lib/system/unlock.lua"
            }
        },
        {
            "name": "add",
            "desc": "Add the given unlock to the user save",
            "params": [
                {
                    "name": "id",
                    "desc": "unlock identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if the unlock was not added before",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "../../res/data/script/lib/system/unlock.lua"
            }
        },
        {
            "name": "remove",
            "desc": "Remove the given unlock from the current user save",
            "params": [
                {
                    "name": "id",
                    "desc": "unlock identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "true if an unlock was removed",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 40,
                "path": "../../res/data/script/lib/system/unlock.lua"
            }
        },
        {
            "name": "clear",
            "desc": "Clear all unlocks from the current user save",
            "params": [],
            "returns": [
                {
                    "desc": "true if any unlock was removed",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 49,
                "path": "../../res/data/script/lib/system/unlock.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Unlock",
    "desc": "The unlock interface\n\n```lua\nUnlock.add(\"rogue\")\nif Unlock.check(\"rogue\") then\n    Unlock.remove(\"rogue\")\nend\n```",
    "source": {
        "line": 12,
        "path": "../../res/data/script/lib/system/unlock.lua"
    }
}