lua-users home
lua-l archive

Re: Help with sting compare?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Ron Hudson wrote:
I can do this from interactive lua and it seems to work, but when I use it in
a lua program it does not work..
I am reading through a file that has variable length records, records are separated
with a line containing only the "&". The last line in the file has "&&".
repeat
 aline = read.io()
 if aline == "&" then
 count = count + 1
 end
until aline == "&&"
Neither "&" or "&&" are ever detected.
I have checked the file... & and && are the only thing in the line.
I also have ">" .. aline .. "<" printed and see >&<
I don't get it... it should be straight forward.
try declaring aline before the repeat...until block.
i had a similar problem which this approach fixed - i surmised that it was a variable scoping issue.
Adrian

AltStyle によって変換されたページ (->オリジナル) /