Posted 31 May 2016 - 09:40 PM
Hello,
I've recently been trying to write my own quarry program : This will be the first big program I will ever write, so before I searched for some info about LUA. I know there's a ton of them in this forum, but I prefer making one myself … because why not \o/
I wrote a function that allows the turtle to compare the blocks above and below him by comparing the names of the blocks that are stored in a table (MiningSave) and the name of the blocks with turtle.inspectUp() and turtle.inspectDown().
The problem is that whenever the program uses this function, I get an "attempt to index ? (a nil value)" error. Any help please ?
Fiixii52.
I've recently been trying to write my own quarry program : This will be the first big program I will ever write, so before I searched for some info about LUA. I know there's a ton of them in this forum, but I prefer making one myself … because why not \o/
I wrote a function that allows the turtle to compare the blocks above and below him by comparing the names of the blocks that are stored in a table (MiningSave) and the name of the blocks with turtle.inspectUp() and turtle.inspectDown().
function isJunkBlock(direction)
local MaxTable = table.maxn(MiningSave)
for i=8,MaxTable do
if direction == "up" then
local Success,Data = turtle.inspectUp()
elseif direction == "down" then
local Success,Data = turtle.inspectDown()
end
if Data.name == MiningSave[i] then
return true
end
end
return false
end
The problem is that whenever the program uses this function, I get an "attempt to index ? (a nil value)" error. Any help please ?
Fiixii52.