lua-users home
lua-l archive

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

> On Aug 8, 2018, at 1:00 PM, Gé Weijers <> wrote:
> I don't see a whole lot of use for this, if a module fails to load retrying is not going to help much in almost all use cases, except where you're loading components on demand. In that case I would suggest writing a wrapper around 'require' to get the behavior needed.

In a previous life I wrote a system where the lua app could require a particular module and, if the require failed, request that the module  be loaded from a depot and then re-require it. 

The download-and-install functionality was in a separate module - we did not modify the require code in the PUC-Rio lua source due to project requirements.

It could have been a wrapper encapsulating the “require/install/re-require” logic ... but that only would have made life a bit easier for our application developers —- we would have still needed to re-require

> Another downside of returning 'false' is that you have to test the return value of each 'require',

Isn’t it good programming practice to always check return values?