Difference between revisions of "Turtle.transferTo"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
(Made it clear that arg is optional, converted to type templates, corrected grammar, italicized arguments in context)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=turtle.transferTo
 
|name=turtle.transferTo
|args=slot, quantity  
+
|args={{type|int}} slot [, {{type|int}} quantity]
|returns=bool "success"
+
|returns={{type|boolean}} success
 
|api=turtle
 
|api=turtle
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Transfers items from the selected slot to the specified slot in the quantity given.  If the [quantity] argument is omitted, tries to transfer all the items from the selected slot.  If the destination slot already has items of a different type, returns false (does not try to fill the next slot, like suck() would).  If there are fewer than [quantity] items in the selected slot or only room for fewer items in the destination slot, transfers as many as possible and returns true.  If none can be transferred, returns false.
+
|desc=Transfers ''quantity'' items from the selected slot to ''slot''.  If the ''quantity'' argument is omitted, tries to transfer all the items from the selected slot.  If the destination slot already has items of a different type, returns false (does not try to fill the next slot, like suck() would).  If there are fewer than ''quantity'' items in the selected slot or only room for fewer items in the destination slot, transfers as many as possible and returns true.  If none can be transferred, returns false.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
Line 13: Line 13:
 
}}
 
}}
 
}}
 
}}
This function came available in version 1.45
+
This function became available in version 1.45
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Revision as of 20:23, 4 May 2013


Grid Redstone.png  Function turtle.transferTo
Transfers quantity items from the selected slot to slot. If the quantity argument is omitted, tries to transfer all the items from the selected slot. If the destination slot already has items of a different type, returns false (does not try to fill the next slot, like suck() would). If there are fewer than quantity items in the selected slot or only room for fewer items in the destination slot, transfers as many as possible and returns true. If none can be transferred, returns false.
Syntax turtle.transferTo(int slot [, int quantity])
Returns boolean success
Part of ComputerCraft
API turtle

Examples

Grid paper.png  Example
Transfers 32 items from the selected slot to slot 6.
Code
turtle.transferTo(6, 32)


This function became available in version 1.45