Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- required ComputerCraft1.65
- local block_names = {
- {"dirt",0}, "stone", {"wool",1}
- }
- function digFor(tbl)
- if not tbl then return turtle.dig() end
- local status, value = turtle.inspect()
- if status then
- local name = value["name"]
- local meta = value["metadata"]
- for i,v in ipairs(block_names) do
- if type(v)=="table" then
- if string.match(name,v[1]) and meta == v[2] then
- return turtle.dig()
- end
- else
- if string.match(name,v) then
- return turtle.dig()
- end
- end
- end
- return false, "No block to match"
- else
- return turtle.dig()
- end
- end
- while true do
- print(digFor(block_names))
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement