lua-users home
lua-l archive

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

On Sun, May 24, 2009 at 3:06 AM, Agi Shi <> wrote:
> Hi all!  I'm nullsquared, new to the mailing list, with a bit of a
> complicated situation.
> This code:
> Works 100% under Lua 5.0.x (paired with any recent version of luabind), but
> fails under Lua 5.1.4 with the runtime error message: invalid key to 'next'
> When sheet.update() is called, it iterates over the passed in table and
> creates a GUI; the table itself is only read, not modified, and it is
> iterated over via standard luabind table iterators.
> I cannot quite figure out why Lua 5.1.4 breaks my code, any ideas?

As stated in the Lua reference manual, this means that during the
iteration you are assigning to a key that didn't exist prior to the
iteration.  This was the case in Lua 5.0, however the error is not
guaranteed to happen each and every time.

Keep in mind that the assignment can be setting the element to nil.
You can do any assignments to keys that already existed prior to the
iteration, just not any new ones.

- Jim