Posted 30 January 2016 - 09:55 PM
Hi programmers, my name in game is Adrikus, i started to program recently in computerCraft, but i programmed before in Java, but lua is too complex for me, i make a function in lua that seeks a object in minecraft, here i put an example.
if you want search another object you can rename the variable.
——————————————————————————–
function searchObject()
local data;
local pos = -1;
for i = 1,16 do
data = turtle.getItemDetail(i).name;
if(data == "minecraft:wheat_seeds") then
pos = i
break;
end
return pos;
end
——————————————————————————–
And the turtle have problems with turtle.getItemDetail(), and this is that problem attempt to index ? (a nil value).
If you could help me would you do me happy!!!
Thanks
if you want search another object you can rename the variable.
——————————————————————————–
function searchObject()
local data;
local pos = -1;
for i = 1,16 do
data = turtle.getItemDetail(i).name;
if(data == "minecraft:wheat_seeds") then
pos = i
break;
end
return pos;
end
——————————————————————————–
And the turtle have problems with turtle.getItemDetail(), and this is that problem attempt to index ? (a nil value).
If you could help me would you do me happy!!!
Thanks