44 posts
Location
Livonia
Posted 25 March 2012 - 07:32 PM
I keep getting an "end" expected at line 216, and i want to know why, because my code doesn't stop there and i think i maxed out the possible loops in a loop or something. Can someone take a look?
Link to pastebin
here.
38 posts
Location
The IRC channel.
Posted 25 March 2012 - 07:39 PM
Simple
You shouldn't add an end after ever elseif
what you did
if Bla then
elseif Blar then
end
elseif Blargh then
end
What you should do
if Bla then
elsif Blar then
elseif Blargh then
end –1 end
44 posts
Location
Livonia
Posted 25 March 2012 - 08:15 PM
What you should do
if Bla then
elsif Blar then
elseif Blargh then
end –1 end
ok, but i want it to make it so if it failed to connect to try again, will the fix do that?
378 posts
Location
In the TARDIS
Posted 25 March 2012 - 08:33 PM
Yeah sure. If the if-clause is in the loop it just restarts the loop after checking and checks again
53 posts
Posted 25 March 2012 - 11:56 PM
Also, in addition to what they said, in the future it would help if you indented in an easier to read way. You indent like this:
while true do
setSomething()
foo()
print("detonating in "..time)
setBar(5)
if y ~= z then
while true do
if world:ends() then
x = getMagicNumber(bar)
redstone.setOutput("back")
else break end
sleep(2)
end
else break
end
sleep(1)
end
When it should look something like this:
while true do
setSomething()
foo()
print("detonating in "..time)
setBar(5)
if y ~= z then
while true do
if world:ends() then
x = getMagicNumber(bar)
redstone.setOutput("back")
else
break
end
sleep(2)
end
else break
end
sleep(1)
end
The second version is the same code, just a lot more readable. You can check to see if you have too many ends or not enough.