[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] mergelua
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Mon, 17 Oct 2011 10:31:59 +0200
2011/10/16 Sebastien Lai <firstname.lastname@example.org>:
> On Sun, Oct 16, 2011 at 3:40 AM, David Manura <email@example.com> wrote:
>> I believe it's preferred to utilize package.preload rather than
>> override require.
> I've been trying to insert package.preloade[<modulename>] = <etc> in
> different ways, but it did not quite work for me.
Here is a simple working example :
package.preload.a = function(name)
_NAME = name,
f = print,
local b = require 'a'
What may not be clear is that preload must not contain the modules
themselves, but rather loader functions (that is, the functions that
will actually create the module, for example the body of a module