Skip to main content

Inventory

The inventory interface

Functions

reset

Inventory.reset() → ()

Removes all items from the inventory.

clear

Inventory.clear() → ()

Removes all items from the inventory except for quest items.

free

Inventory.free() → ()

Removes all temporary items from the inventory.

get

Inventory.get(
typestring--

item type identifier

) → ItemRef

Gets an item by type string.

default

Inventory.default(
typestring--

item type identifier

) → ()

Gets the item definition by type string.

When an item gets created (its count changes from zero), the item gets generated by this default definition.

Show raw api
{
    "functions": [
        {
            "name": "reset",
            "desc": "Removes all items from the inventory.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 11,
                "path": "../../res/data/script/lib/system/inventory.lua"
            }
        },
        {
            "name": "clear",
            "desc": "Removes all items from the inventory except for quest items.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "../../res/data/script/lib/system/inventory.lua"
            }
        },
        {
            "name": "free",
            "desc": "Removes all temporary items from the inventory.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "../../res/data/script/lib/system/inventory.lua"
            }
        },
        {
            "name": "get",
            "desc": "Gets an item by type string.",
            "params": [
                {
                    "name": "type",
                    "desc": "item type identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ItemRef"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 31,
                "path": "../../res/data/script/lib/system/inventory.lua"
            }
        },
        {
            "name": "default",
            "desc": "Gets the item definition by type string.\n\nWhen an item gets created (its count changes from zero), the item gets\ngenerated by this default definition.",
            "params": [
                {
                    "name": "type",
                    "desc": "item type identifier",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 43,
                "path": "../../res/data/script/lib/system/inventory.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Inventory",
    "desc": "The inventory interface",
    "source": {
        "line": 5,
        "path": "../../res/data/script/lib/system/inventory.lua"
    }
}