minetest.create_detached_inventory - Uberi/MineTest-API GitHub Wiki

minetest.create_detached_inventory

Description

returns InvRef

Syntax

[InvRef](../type/InvRef.html) create_detached_inventory([string](../type/string.html) name, [detachedinventory](../type/detachedinventory.html) callbacks)

Examples

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,

})
⚠️ **GitHub.com Fallback** ⚠️