lua-users home
lua-l archive

cannot index a table loaded as a chunk

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


I am using lus 5.0 and I have a strange problem with tables being used as
classes. I define the class as a table. It has one variable inside.The
scripthas a command that calls a Cfunction named Include(filename) which
itself uses luaL_loadfile() to load a class definition named Img. When the
main chunk gets to Img:new() [as on page 138 of the lua book], it fails
with this message from lua:
 "... : attempt to index global `Img' (a nil value)"
In other words, the table Img defined in a separate file is considered not
yet defined. it is almost as if each chuck is having its own set of "static"
globals rather than merging them into a single pool.
Ideas?
Michael

AltStyle によって変換されたページ (->オリジナル) /