Difference between revisions of "Turtle inventory (event)"
From ComputerCraft Wiki
(Created page) |
(apparently turtles don't know where they're being ticked at....who knew?) |
||
Line 3: | Line 3: | ||
|name=turtle_inventory | |name=turtle_inventory | ||
|desc=Fired when the inventory of the turtle is altered in any slot. | |desc=Fired when the inventory of the turtle is altered in any slot. | ||
− | |return1=The | + | |return1=The event "turtle_inventory". |
|examples= | |examples= | ||
{{Example | {{Example | ||
Line 10: | Line 10: | ||
while true do | while true do | ||
local event, p1 = [[os.pullEvent]]("[[turtle_inventory_(event)|turtle_inventory]]") | local event, p1 = [[os.pullEvent]]("[[turtle_inventory_(event)|turtle_inventory]]") | ||
− | [[print]]("Inventory has | + | [[print]]("Inventory has changed") |
end | end | ||
− | |output=If the inventory in slot | + | |output=If the inventory in any slot has changed, or the player has clicked inside the turtle, the output is: "Inventory has changed". |
}} | }} | ||
− | '''Note: '''This event can fire even if the inventory has not changed, such as if the player has clicked on an empty slot | + | '''Note: '''This event can fire even if the inventory has not changed, such as if the player has clicked on an empty slot. |
}} | }} |
Revision as of 15:44, 29 October 2013
Event turtle_inventory | |
Fired when the inventory of the turtle is altered in any slot. | |
Returned Object 1 | The event "turtle_inventory". |
Examples
Example | |
Returns the slot number when the inventory in slot 1 is changed. | |
Code |
while true do local event, p1 = os.pullEvent("turtle_inventory") print("Inventory has changed") end |
Output | If the inventory in any slot has changed, or the player has clicked inside the turtle, the output is: "Inventory has changed". |
Note: This event can fire even if the inventory has not changed, such as if the player has clicked on an empty slot.