[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: cannot index a table loaded as a chunk
- From: "Michael Newberry" <mnewberry@...>
- Date: Fri, 20 Aug 2004 15:01:42 -0700
Ashwin,
Thank you for your help. Yes, I accidentally added an error to the included
chunk trying to get this to work late at night. But now we are back to
square 1 and I still have the problem that it does not work. Since last
night, I did this (along with many other dead ends):
1. Recompiled using 5.02 rather than 5.0 and with no change in the problem.
2. In the Include() Cfunction that loads the chunk, I also changed
lua_dofile() to luaL_loadfile() so that I could see the chunk loaded but not
executed. Now, luaL_loadfile returns 0 as it should, so I put an error on
line 388 (at the end) to see that it was loading the chunk because it
reported the error on that line.
So it seems like the class definition cannot be loaded from a separate
chunk. Would this have anything to do with he commands I use to execute the
script? Here is my source:
(the script to run is in a file named sScriptFile)
m_pLuaState = lua_open();
if ( m_pLuaState != NULL )
{
RegisterLuaPackages(); // lua packages: debug, math, table, etc.
RegisterLuaFuncs(); // load our CFunctions
int nError = luaL_loadfile( m_pLuaState, sScriptFile );
if ( ! nError ) // returns 0 if success loading script from file
{
nError = lua_pcall( m_pLuaState, 0, LUA_MULTRET, 0 ); // run
the script
...
The script includes a CFunction named Include which uses luaL_loadfile()
to load chunks into the same lua state.
Michael
----- Original Message -----
From: "Ashwin Hirschi" <deery@operamail.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, August 20, 2004 11:33 AM
Subject: Re: cannot index a table loaded as a chunk
>
> > I have been looking for the origin of the return code 3 from lua_dofile.
I
> > don't find a 3 through the calls down to luaD_protectedrun(). Does
anyone
> > know where a return code of 3 can come from?
>
> { ... having a quick peek at lua.h }
>
> Isn't 3 equal to the LUA_ERRSYNTAX return value?
>
> Perhaps you should run the script you're trying to load/run through luac
to see if anything's amiss.
>
> Ashwin.
> --
> no signature is a signature.
>