Inventories: Update chapter

This commit is contained in:
rubenwardy 2022-08-01 19:05:44 +01:00
parent bfc343d1f5
commit 51cf848657

View File

@ -105,7 +105,6 @@ chest. The node must be loaded because it is stored in
[node metadata](../map/storage.html#metadata). [node metadata](../map/storage.html#metadata).
```lua ```lua
-- In a node def
on_punch = function(pos, node) on_punch = function(pos, node)
local inv = minetest.get_inventory({ type="node", pos=pos }) local inv = minetest.get_inventory({ type="node", pos=pos })
-- now use the inventory -- now use the inventory
@ -151,10 +150,9 @@ before accessing it:
minetest.create_detached_inventory("inventory_name") minetest.create_detached_inventory("inventory_name")
``` ```
The create_detached_inventory function accepts 3 arguments, where only the first - the inventory name - The `create_detached_inventory` function accepts 3 arguments, where only the
is required. first - the inventory name - is required. The second argument takes a table of
The second argument takes a table of callbacks, which can be used to control how callbacks, which can be used to control how players interact with the inventory:
players interact with the inventory:
```lua ```lua
-- Input only detached inventory -- Input only detached inventory