lua-users home
lua-l archive

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


Sorry about the problems of clarity and the typos in my previous message. It
is 1:30 in the morning and I have been wrestling with this problem all
evening.

Michael

----- Original Message ----- 
From: "Michael Newberry" <mnewberry@axres.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, August 20, 2004 1:29 AM
Subject: cannot index a table loaded as a chunk


> 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
>
>
>