Jump to content




[Error] Then Expected


  • You cannot reply to this topic
3 replies to this topic

#1 civilwargeeky

  • Members
  • 393 posts

Posted 12 October 2012 - 11:33 PM

So I'm making a simple program to decipher a cipher of sorts. I'm adding more code later to actually decipher, but I ran into an early problem. On line 26 Then Expected.
t = {"S","E","N","I","O","R"," ","C","I","N","E","M","A","T","I","C","S"," ","D","E","S","I","G","N","E","R"}
y = {0}
currnt = {0}
buffer = 0
pos = 1
for i=1, 30 do
y[i] = 0
end

print("Stage one:")
for i=1, 26 do
write(t[i])
end
print("")

print("Stage Two:")
while buffer ~= "Stop" do
buffer = read()
table.insert(currnt,pos,buffer)
lttr = t[tonumber(buffer)]
table.insert(y,pos,lttr)
pos = pos+1
end

for i=1, pos do
if y[i]=0 then
write(currnt[i])
else
write(y[i])
end
end
Line 26 is at the end: if y[i]=0 then

#2 faubiguy

  • Members
  • 213 posts

Posted 12 October 2012 - 11:38 PM

Use
if y[i]==0 then

== is the comparison operator, = is the assignment operator.

#3 civilwargeeky

  • Members
  • 393 posts

Posted 12 October 2012 - 11:42 PM

Wow thanks. I feel really stupid now...

#4 ChaddJackson12

  • Members
  • 264 posts

Posted 13 October 2012 - 12:24 AM

View Postcivilwargeeky, on 12 October 2012 - 11:42 PM, said:

Wow thanks. I feel really stupid now...
Lol, this happens to me all of the time!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users