500 posts
Posted 02 April 2013 - 03:06 PM
I'm having a problem with this code:
Spoiler
local function input(a)
if a==0 then
while true do
event, p1, p2, p3 = os.pullEvent("mouse_click")
if p2>=9 and p2<=41 and p3>1 then
if p3>=4 and p3<=6 then
if p1=="left" then
break
–
else
window(0, 1, p2, p3) –Menu, Win, X, Y
end
elseif p3>=9 and p3<=11 then
if p1=="left" then
break
–
else
window(0, 2, p2, p3)
end
elseif p3>=14 and p3<=16 then
if p1=="left" then
break
–
else
window(0, 3, p2, p3)
end
end
elseif p3==1 then
if p2>=1 and p2<=3 the It says that I have to close an "if" that starts here.
if toolbar then
disp("in")
else
disp("out")
end
elseif p2>=5 and p2<=13 and toolbar then
break
menuNum = 1 And the "end" is expected here.
toolbar = false
elseif p2>=15 and p2<=24 and toolbar then
break
menuNum = 2
toolbar = false
elseif p2>=26 and p2<=32 and toolbar then
break
menuNum = 3
toolbar = false
elseif p2>=34 and p2<=39 and toolbar then
break
stop = true
end
end
end
– elseif a==1 then
– event, p1, p2, p3 = os.pullEvent()
end
end It says I'm missing an end, but I can't figure out where :/.
When I pasted my code down it screwed up the spacing, so I just colored it up since I was too lazy to respace it :P/>.
Thanks in advance!
1511 posts
Location
Pennsylvania
Posted 02 April 2013 - 03:17 PM
Ok what line is it on? Secondly, what is on that line. I would rather a Necromancer spread black magic for the rest of eternity than to read all of the code you just posted…
Props for using a spoiler though ^_^/>
EDIT: i just indented all the code properly in Notepad++, give me the error log and I will try to find your problem
500 posts
Posted 02 April 2013 - 03:29 PM
Ok what line is it on? Secondly, what is on that line. I would rather a Necromancer spread black magic for the rest of eternity than to read all of the code you just posted…
Props for using a spoiler though ^_^/>
EDIT: i just indented all the code properly in Notepad++, give me the error log and I will try to find your problem
Oops, sorry, my bad. I added it in the spoiler. Thanks for helping me by the way :)/>.
1511 posts
Location
Pennsylvania
Posted 02 April 2013 - 03:36 PM
When you break a loop, it does not read anything from there on out. Do the stuff before you break instead.
–stuff
break
instead of
break
–stuff
2088 posts
Location
South Africa
Posted 02 April 2013 - 09:52 PM
Please copy all the code, type
, right click -> paste as plain text, type [[b]/[/b]code]. I beg of you.
Code tags are 1000x times better than setting your own colours
Btw, breaks and returns need to be the [b]LAST[/b] thing in a block. Move the break to the end of the elseif block
500 posts
Posted 03 April 2013 - 02:24 AM
Please copy all the code, type
, right click -> paste as plain text, type [[b]/[/b]code]. I beg of you.
Code tags are 1000x times better than setting your own colours
Btw, breaks and returns need to be the [b]LAST[/b] thing in a block. Move the break to the end of the elseif block
I was going to do that, but then decided against it because you wouldn't be able to see what ends what, so I decided to color it, but coloring didn't work in code text, so I just took off the code tags, but I'll keep that in mind for next time. Thanks!
When you break a loop, it does not read anything from there on out. Do the stuff before you break instead.
–stuff
break
instead of
break
–stuff
OK, thanks!
2088 posts
Location
South Africa
Posted 03 April 2013 - 02:26 AM
Ask anyone, everyone will say use code tags instead.
If you can't see what ends what, use indentation
500 posts
Posted 03 April 2013 - 02:28 AM
Ask anyone, everyone will say use code tags instead.
If you can't see what ends what, use indentation
Yeah, in the future I will.
It was indented, but when I pasted it, it came out flat :/.
Thanks again!
2088 posts
Location
South Africa
Posted 03 April 2013 - 02:53 AM
You using google chrome?
When pastebin, click the top left icon "Toggle editing mode" and then paste, indentation will remain
7508 posts
Location
Australia
Posted 03 April 2013 - 03:33 AM
You using google chrome?
When pastebin, click the top left icon "Toggle editing mode" and then paste, indentation will remain
or when making the code make tabs a 2 space indent instead of 4.
2088 posts
Location
South Africa
Posted 03 April 2013 - 04:49 AM
or when making the code make tabs a 2 space indent instead of 4.
while true do
ll
test
end
...
...
..
.
..
.
doesn't work for me :/ made it 2
7508 posts
Location
Australia
Posted 03 April 2013 - 05:03 AM
doesn't work for me :/ made it 2
ST2 right?
make sure the "Indent Using Spaces" is checked and it will work. thats how I get the spacing on the forums all the time.
2088 posts
Location
South Africa
Posted 03 April 2013 - 05:06 AM
ST2?
Yeah I know spaces will work but I want to keep it as tabs :P/>
teas
asd
asd
asdasd
asdasd
asdasd
asdasd
hmm maybe i will use it :?
7508 posts
Location
Australia
Posted 03 April 2013 - 05:11 AM
2088 posts
Location
South Africa
Posted 03 April 2013 - 05:12 AM
Oh no, I use Notepad++
Why does firefox keep the indentation though? (even using tabs - without the replace tabs with spaces option enabled)