lua-users home
lua-l archive

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


There was a bug in the test submitted by the user:

       local readable,writable,
       for src, _ in ipairs(readable) do
               local udp=receive_sockets[src]

The index 'src' is valid only for table 'readable'. Not for table
'receive_sockets'. In fact, there is no need to use the index.

       local readable,writable,
       for _, udp in ipairs(readable) do

This is a simpler alternative.

The reason the code worked in some systems is that when all
sockets are readable simultaneously, the indices on both
tables end up matching so the bug goes unnoticed.