InvRef

From Minetest Developer Wiki
Revision as of 12:43, 28 November 2012 by Xyz (talk | contribs)
Jump to navigation Jump to search

Reference to an inventory.

Methods

  • is_empty("listname"): return true if list is empty
  • get_size("listname"): get size of a list
  • set_size("listname", size): set size of a list
  • get_width("listname"): get width of a list
  • set_width("listname", width): set width of list; currently used for crafting
  • get_stack("listname", i): get a copy of stack index i in list
  • set_stack("listname", i, stack): copy stack to index i in list
  • get_list("listname"): return full list
  • set_list("listname", list): set full list (size will not change)
  • [InvRef]add_item("listname", stack): add item somewhere in list, returns leftover ItemStack
  • room_for_item("listname", stack): returns true if the stack of items can be fully added to the list
  • contains_item("listname", stack): returns true if the stack of items can be fully taken from the list
  • remove_item("listname", stack): take as many items as specified from the list, returns the items that were actually removed (as an ItemStack)