detachedinventory - Uberi/MineTest-API GitHub Wiki

detachedinventory

Description

A table defining various functions of the detached inventory.

Used with minetest.create_detached_inventory.

Return value of each allow_* callback should be the number of items allowed to move, or -1 to copy the stack instead. The on_* callbacks have no return value.

Syntax

{
	-- 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,

	-- 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** ⚠️