[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How can a module intentionally fail to load?
- From: Daurnimator <quae@...>
- Date: Tue, 7 Aug 2018 14:26:44 +1000
On 7 August 2018 at 14:19, Sean Conner <sean@conman.org> wrote:
> But ...
>
>> print(package.loaded['org.conman.nfl.tls'])
> userdata: 0x8064634
>>
>
> I think the userdata is the .so file (because each userdata in the TLS
> module has a __tostring() method assigned to it), which is an unexpected
> result.
Nope. It's a hack by lua5.1 to detect require loops. It was removed in
5.2 (yet another reason to upgrade!)
$ lua5.1 -e 'package.preload.foo=function() error("foo") end;
pcall(require,"foo"); print(package.loaded.foo)'
userdata: 0x4216d4
$ lua5.2 -e 'package.preload.foo=function() error("foo") end;
pcall(require,"foo"); print(package.loaded.foo)'
nil