function drop(fslot,lslot)
for fslot,lslot do
turtle.select(i)
while turtle.drop() == false and turtle.getItemCount(fslot) ~= 0 do
print("Can't drop items- full?")
end
end
end
Any ideas? Thanks
for loop- "in"
Started by Apfeldstrudel, Jun 01 2013 12:55 PM
4 replies to this topic
#1
Posted 01 June 2013 - 12:55 PM
Hi! i have written a turtle program and while improving it i got the following error :'in expexted' in this function:
#2
Posted 01 June 2013 - 12:58 PM
turtle.select(i)
i is not declared anywhere in this.
i is not declared anywhere in this.
#3
Posted 01 June 2013 - 12:59 PM
popdog15, on 01 June 2013 - 12:58 PM, said:
turtle.select(i)
i is not declared anywhere in this.
i is not declared anywhere in this.
You didn't even read the error did you?
----------
@op: You really should provide the whole code.
As for your issue, you are using an invalid for loop.
A for loop can be written in one of two ways:
1) for i=1, 100 do
2) for a, b in iterator(stuff) do
You are using neither. My guess is that you are trying to do the former. If so, try this instead:
function drop(fslot,lslot)
for i=fslot,lslot do --# It looks like you just forgot to set i=fslot
turtle.select(i)
while turtle.drop() == false and turtle.getItemCount(i) ~= 0 do
print("Can't drop items- full?")
end
end
end
#4
Posted 01 June 2013 - 01:14 PM
Bubba, on 01 June 2013 - 12:59 PM, said:
popdog15, on 01 June 2013 - 12:58 PM, said:
turtle.select(i)
i is not declared anywhere in this.
i is not declared anywhere in this.
You didn't even read the error did you?
----------
@op: You really should provide the whole code.
As for your issue, you are using an invalid for loop.
A for loop can be written in one of two ways:
1) for i=1, 100 do
2) for a, b in iterator(stuff) do
You are using neither. My guess is that you are trying to do the former. If so, try this instead:
function drop(fslot,lslot)
for i=fslot,lslot do --# It looks like you just forgot to set i=fslot
turtle.select(i)
while turtle.drop() == false and turtle.getItemCount(i) ~= 0 do
print("Can't drop items- full?")
end
end
end
Oh! i thought that i could just use another variable for that, Thanks!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











