[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua module loader from usertype
- From: "Luís Eduardo Jason Santos" <jasonsantos@...>
- Date: Thu, 6 Dec 2007 14:34:50 -0200
Just for clarification..
My loader is 'loadstringing' the module and pushing it. One of the modules I tested is 'LuaDoc' and uses
the 'module(...)' function - so, it would probably register himself
properly if ran.
I don't know if require is executing it properly,
for my loader is a JavaFunction from the LuaJava package. I don't know
which mechanism require uses to execute the module compiled and pushed
by the loader - that's my main doubt.
During my debug, the loader is being executed, the module is
properly compiled and pushed into the stack. (L.type(-1) is 'function'
just before exiting the loader)
On Dec 6, 2007 1:41 PM, Roberto Ierusalimschy <email@example.com
'require' does not return the module. It loads the module, *runs* it,
> I wrote a custom module loader using LuaJava and set it to the package
> loaders table.
> The loader is a user type with a __call int the meta table.
> My problem is, although I am sure the loader is being called and manages
> complile and push a chunk of code as the result of a loadstring operation,
> require cannot get the module - returning a boolean instead.
> Does anyone know if there's a problem returning a function from a loader in
> those conditions?
and returns the result. If the module has no results, 'require' returns
Luís Eduardo Jason Santos