[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How can a module intentionally fail to load?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 8 Aug 2018 10:48:43 +0200
Op Di., 7 Aug. 2018 om 23:10 het Gé Weijers <email@example.com> geskryf:
> Why not throw an error? (e.g. luaL_error(L, "libtls version too old, version = 0x%x", version);)
> A regular return will register the module in the module table, for every value possible it seems. The error handling will bypass that.
You don't want to bypass that.
The return value 'false' is an idiom that does not prevent 'require'
from trying to reload a module, but at the same time allows your
program to test whether there has been a previous unsuccessful