minetest.create_detached_inventory

From Minetest Developer Wiki
Jump to: navigation, search

Syntax

Description

Returns InvRef.

Example

local inv = minetest.create_detached_inventory("my_global_inventory", {
    -- allow_* - return value is the number of items allowed to move, or -1 to copy the stack instead of move
 
    -- Called when a player wants to move items inside the inventory
    allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) end,
 
    -- Called when a player wants to put items into the inventory
    allow_put = function(inv, listname, index, stack, player) end,
 
    -- Called when a player wants to take items out of the inventory
    allow_take = function(inv, listname, index, stack, player) end,
 
    -- on_* - no return value
    -- Called after the actual action has happened, according to what was allowed.
    on_move = function(inv, from_list, from_index, to_list, to_index, count, player) end,
    on_put = function(inv, listname, index, stack, player) end,
    on_take = function(inv, listname, index, stack, player) end,
})
Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox