Posted 25 March 2013 - 02:39 AM
Hi guys, I wrote my one litte API (mine: http://pastebin.com/gnyqhulx) and then i puted some more functions in it. Suddenly when I ran my "testmine" programm (http://pastebin.com/Rs5rzRRy) it gave me this error message and didn't work at all:
testmine:2: attempt to index ? (a function value)
Thank you for reading and may supporting :)/>
testmine:
mine:
testmine:2: attempt to index ? (a function value)
Thank you for reading and may supporting :)/>
testmine:
Spoiler
os.loadAPI("mine")
mine.invClear()
mine:
Spoiler
function invClear()
turtle.select(16)
while not turtle.placeUp() do
turtle.digUp()
end
for i = 1, 10 do
turtle.select(i)
turtle.dropUp()
end
turtle.select(16)
turtle.digUp()
end
function refuel(x)
if x > turtle.getFuelLevel() then
invClear()
turtle.select(15)
while not turtle.placeUp() do
turtle.digUp()
end
end
while x > turtle.getFuelLevel() do
turtle.suckUp()
turtle.refuel()
end
turtle.select(15)
turtle.digUp()
end
function mine(x)
refuel(x + 10)
for i = 1, x do
if turtle.getItemCount(8) > 0 then
invClear()
end
while not turtle.forward() do
turtle.dig()
end
while turtle.detectUp() do
turtle.digUp()
end
turtle.digDown()
end
end
function turn()
if Richtung == "r" then
turtle.turnRight()
mine(1)
turtle.turnRight()
Richtung = "l"
else
turtle.turnLeft()
mine(1)
turtle.turnLeft()
Richtung = "r"
end
end
function calcx()
if (mgox - mendx) >= 0 then
return mgox - mendx
else
return mendx - mgox
end
end
function calcy()
if (mgoy - mendy) >= 0 then
return mgoy - mendy
else
return mendy - mgoy
end
end
function calcz()
if (mgoz - mendz) >= 0 then
return mgoz - mendz
else
return mendz - mgoz
end
end