This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dragonxtamer596's profile picture

Error: index.lua :58: 'end' expected (to close 'if' at line 30)

Started by dragonxtamer596, 21 October 2012 - 12:44 AM
dragonxtamer596 #1
Posted 21 October 2012 - 02:44 AM
code
red = Color.new(255,0,0)
black = Color.new(0,0,0)
white = Color.new(255,255,255)

menustatus = 1

while true do
screen:clear(black)
pad = Controls.read()
end

if pad:up() then
menustatus = menustatus - 1
screen.waitVblankStart(4)
end

if pad:down() then
menustatus = menustatus + 1
screen.waitVblankStart(4)
end

color={white, white, white}

screen:print(50, 50, "Play", color[1])
screen:print(50,60,"Options", color[2])
screen:print(50,70,"Exit", color[3])

color[menustatus]=red

if menustatus == 1 then
if pad:cross() then
dofile("Game.lua")

if menustatus == 2 then
if pad:cross() then
–insert options here
end
end

if menustatus == 3 then
if pad:cross() then
while true do
break
end
end

if menustatus <= 0 then
menustatus = 3
end

if menustatus >= 4 then
menustatus = 1
end

screen.flip()
screen.waitVblankStart()
end
end
jag #2
Posted 21 October 2012 - 03:23 AM
Could you post a description of your problem? Or at least add some
 tags
NIN3 #3
Posted 21 October 2012 - 03:27 AM
Best I can say is that this line
if menustatus == 1 then
if pad:cross() then
dofile("Game.lua")

Is missing 2 ends
Lyqyd #4
Posted 21 October 2012 - 04:00 AM
Best I can say is that this line
if menustatus == 1 then
if pad:cross() then
dofile("Game.lua")

Is missing 2 ends

Those are actually matched at the end of the file. The while true do, on the other hand, is not.
ChunLing #5
Posted 21 October 2012 - 04:26 AM
"while true do break end"…What? It's like you wrote that just to annoy me.
Cloudy #6
Posted 21 October 2012 - 11:27 AM
You're trying to run code made for LuaPlayer on the PSP without alteration. That isn't going to work. Even if you fix your syntax errors it isn't going to work.