Yeah, once I got under the character limit, I stopped trying to optimize. That line-clearing code is much much cleaner than what I had:
for j=17,58 do
for i=5,58 do
if(q(i,j)==0)break
if i==58 then
s+=50
rect(5,j,58,j,0)
for u=j,18,-1 do
for w=5,58 do
z(w,u,q(w,u-1))
z(w,u-1,0)
end
end
end
end
end