lua-users home
lua-l archive

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


 > Hi,
 > 
 > Norman Ramsey wrote:
 > > /usr/local/bin/lua5.1: invalid key to 'next'
 > > [...]
 > > Here is a fragment of the source code:
 > > 
 > >       assert(type(rset) == 'table')
 > >       for r in pairs(rset) do --- this is line 961
 > >         assert(papers[r][pnum], 'reviewed-by and papers are inconsistent')
 > > 
 > > I don't see how this can possibly be wrong, but evidently the compiler
 > > sees something that I don't.  Can anyone suggest what I might do?
 > 
 > Compiler? Nope: the runtime.
 > 
 > Does 'rset' happen to be a weak table or is rset modified inside
 > the loop?

Bingo!  rset is indeed modified instead the loop, and I did have a
test to exit, but I put

   if found then break end

at the *beginning* of the loop (where I wouldn't forget it).
Moving that line to the *end* of the for loop fixes the bug.

Thanks!  I knew I was being stupid.  (I have been doing nothing but
this program for two days straight.)


Norman