Difference between revisions of "InvRef"
Jump to navigation
Jump to search
(Created page with "Reference to an inventory. == Methods == * <source enclose="none">is_empty("listname")</source>: return true if list is empty * <source enclose="none">get_size("listname")</s...") |
|||
Line 11: | Line 11: | ||
* <source enclose="none">get_list("listname")</source>: return full list | * <source enclose="none">get_list("listname")</source>: return full list | ||
* <source enclose="none">set_list("listname", list)</source>: set full list (size will not change) | * <source enclose="none">set_list("listname", list)</source>: set full list (size will not change) | ||
− | * <source enclose="none">add_item("listname", stack)</source>: add item somewhere in list, returns leftover ItemStack | + | * <source enclose="none">[InvRef]add_item("listname", stack)</source>: add item somewhere in list, returns leftover ItemStack |
* <source enclose="none">room_for_item("listname", stack)</source>: returns true if the stack of items can be fully added to the list | * <source enclose="none">room_for_item("listname", stack)</source>: returns true if the stack of items can be fully added to the list | ||
* <source enclose="none">contains_item("listname", stack)</source>: returns true if the stack of items can be fully taken from the list | * <source enclose="none">contains_item("listname", stack)</source>: returns true if the stack of items can be fully taken from the list | ||
* <source enclose="none">remove_item("listname", stack)</source>: take as many items as specified from the list, returns the items that were actually removed (as an ItemStack) | * <source enclose="none">remove_item("listname", stack)</source>: take as many items as specified from the list, returns the items that were actually removed (as an ItemStack) |
Revision as of 12:43, 28 November 2012
Reference to an inventory.
Methods
is_empty("listname")
: return true if list is emptyget_size("listname")
: get size of a listset_size("listname", size)
: set size of a listget_width("listname")
: get width of a listset_width("listname", width)
: set width of list; currently used for craftingget_stack("listname", i)
: get a copy of stack index i in listset_stack("listname", i, stack)
: copy stack to index i in listget_list("listname")
: return full listset_list("listname", list)
: set full list (size will not change)[InvRef]add_item("listname", stack)
: add item somewhere in list, returns leftover ItemStackroom_for_item("listname", stack)
: returns true if the stack of items can be fully added to the listcontains_item("listname", stack)
: returns true if the stack of items can be fully taken from the listremove_item("listname", stack)
: take as many items as specified from the list, returns the items that were actually removed (as an ItemStack)