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

[Error] Then Expected

Started by civilwargeeky, 12 October 2012 - 10:33 PM
civilwargeeky #1
Posted 13 October 2012 - 12:33 AM
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=0 then
faubiguy #2
Posted 13 October 2012 - 12:38 AM
Use

if y[i]==0 then

== is the comparison operator, = is the assignment operator.
civilwargeeky #3
Posted 13 October 2012 - 12:42 AM
Wow thanks. I feel really stupid now…
ChaddJackson12 #4
Posted 13 October 2012 - 01:24 AM
Wow thanks. I feel really stupid now…
Lol, this happens to me all of the time!