Posted 29 October 2012 - 02:41 PM
I'm having trouble getting this program to work. It keeps giving me an error
'then' expected on line 14, it's there and it just won't run.
'then' expected on line 14, it's there and it just won't run.
Spoiler
tBoard1={" ";" ";" ";" ";" ";}
tBoard2={" ";" ";" ";" ";" ";}
tHeader={1;2;3;4;5;}
sSColumn=0
sSRow=0
sGColumn=0
sGrow=0
print([[ Enter starting point by typing in the column number first. ]])
sSColumn=read()
if tonumber(sSColumn) = nil then
print([[You entered an invaild column number.]])
else
while true do
print([[now enter the row number.]])
sSRow=[read()]
if tonumber(sSRow) = nil then --right here
print([[you entered an invaild row number. try again.]])
end
break
end
end
print([[ Enter goal point by typing in the column number first. ]])
sGColumn=read()
if tonumber(sGColumn) = nil then
print([[You entered an invaild column number.]])
else
while true do
print([[now enter the row number.]])
sGRow=[read()]
if tonumber(sGRow) = nil then
print([[you entered an invaild row number. try again.]])
end
break
end
end
if sSColumn=sGColumn or sSRow=sGRow then
print([[Error]])
restart()
end
if sSRow = 1 then
tBoard1[sSColumn] = "S"
else
tBoard2[sSColumn] = "S"
end
if sGRow = 1 then
tBoard1[sGColumn] = "G"
else
tBoard2[sGColumn] = "G"
end
print(tHeader)
print(tBoard1)
print(tBoard2)