[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to overwrite a function that is late-loaded using loadfile()
- From: "RJP Computing" <rjpcomputing@...>
- Date: Thu, 27 Nov 2008 14:18:59 -0500
On Thu, Nov 27, 2008 at 5:55 AM, Geoff Richards <Ni1phahs@ungwe.org> wrote:
Could you just preload the module by calling 'require' yourself
before 'loadfile'? That would give you the chance to update whatever
table the module returns or globals it creates. Lua's module caching
will prevent the module's initialization stuff being run again after
you've fiddled with it.
Yes and that is what I am doing right now, but I am trying to make this a generic app that has a limited list of dependencies. This way not everybody will have to have the module to use this application. It is distributed with an application at work. It is a good function though so I like the name and it will fix perfectly into the way the application is written.
Can I force the overwrite to happen after 'loadfile()' is called?