local function get_inventory (pos) local meta = minetest.get_meta(pos) return minetest.deserialize(meta:get_string("inventory")) end local function set_inventory (pos, inventory) local meta = minetest.get_meta(pos) meta:set_string("inventory", minetest.serialize(inventory)) end local function push (pos, value) local inventory = get_inventory(pos) if not inventory then return false end table.insert(inventory, value) set_inventory(pos, inventory) return true end local function pop (pos) local inventory = get_inventory(pos) if not inventory then return nil end local value = table.remove(inventory, 1) set_inventory(pos, inventory) return value end local function place_funnel (itemstack, placed, pointed) local result = minetest.item_place(itemstack, placer, pointed) local pos = pointed.above local meta = minetest.get_meta(pos) set_inventory(pos, {}) return result end local function dig_funnel (pos, ...) local result = minetest.node_dig(pos, ...) return result end return { get_inventory = get_inventory, set_inventory = set_inventory, place_funnel = place_funnel, dig_funnel = dig_funnel, push = push, pop = pop, }