lua-users home
lua-l archive

[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 "&&".

    aline =
    if aline == "&" then
      count = count + 1
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.