lua-users home
lua-l archive

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

On Sun, Nov 1, 2009 at 3:01 PM, Mike Pall <> wrote:
> Steven Johnson wrote:
>> I'm running into some issue with module() and / or environments. The
>> attached file is a dump of the package
>> table, just before an error gets thrown: "attempt to index global
>> 'widgetops' (a nil value)".
> I'm a bit stumped on that one ... does it work with the pure
> interpreter (-j off)?
> Anyway, I'd probably need a lot more context to analyze this.
> Maybe you could try to reduce this to a minimal test case?

Sure, I'll see what I can do. This is embedded in a pretty big program and
I think I've got meetings and such this week, so it might be a few days
getting around to it.

I tried a run with a call at the beginning and got similar results.

Probably also nothing obvious, but just in case:

It does not seem particularly fond of looping over package.loaders (as evidenced
by the abrupt end of the dump once package.loaded closes), and this is true
even when I dump only that table. On the other hand, I can iterate it
without trouble
in the command line, so maybe I've stepped on something.

>> Any ideas? What seems most odd to me is the change from before to
>> after the luaL_register()...
> Since this is a mix of Lua and C: have you checked that all your
> luaL_check*() and luaL_opt*() calls do *not* use negative indexes?
> Because that's an incompatibility in beta1 (patch posted to the list).
> --Mike

I applied the patch beforehand. I do use negative indices, and worse still
pseudo-indices (mea maxima culpa). I have since gotten rid of the latter,
so far as a quick search revealed, though I'll have to give it a more thorough
check when I've had some rest.