Posted 18 June 2013 - 01:30 PM
i need to make code that would go like this
local x = turtle.getSlotNumber()+1
turtle.select(x)
local x = turtle.getSlotNumber()+1
turtle.select(x)
--at the top of the program:
local selection = 1
turtle.select(1)
local oldTurtleSelect = turtle.select
turtle.select = function(slot)
if type(slot) ~= "number" then error("number expected, got "..type(slot)) end
if slot < 1 or slot > 16 or math.floor(slot) ~= slot then error("bad argument") end
selection = slot
oldTurtleSelect(slot)
end
turtle.getSelect = function()
return selection
end
--at the bottom:
turtle.getSelect = nil
turtle.select = oldTurtleSelect