[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How can a module intentionally fail to load?
- From: Daurnimator <quae@...>
- Date: Tue, 7 Aug 2018 16:38:29 +1000
On 7 August 2018 at 16:05, Dirk Laurie <email@example.com> wrote:
> Inside that 'if', write a message on io.stderr and return false.
This will manifest as e.g. a user reporting an error about trying to
When they try and run code such as:
tls = require "org.conman.nfl.tls"
-- at some point later in response to user input:
It's better to fail fast and keep the error message close to the cause!
But also, writing to stderr from a library is an antipattern: please
never do this.
I might e.g. just be checking to see if your module is available and do:
I don't want output appearing in the user's terminal when I do that!