[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Checking whether a shared library has been loaded
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 9 Feb 2015 17:26:04 +0200
2015-02-09 17:19 GMT+02:00 Luiz Henrique de Figueiredo <firstname.lastname@example.org>:
>> > No record is kept of anything loaded with "package.loadlib".
>> The following session strongly seems to suggest that an
>> undocumented feature of Lua 5.3, not present in Lua 5.2,
>> is a table in the registry keyed by the filenames of libraries
>> loaded with "package.loadlib".
> Ah, Lua 5.3 replaced _CLIBS by an anonymous table whose key is a userdata.
> _CLIBS is used for cleanup. It is an implementation detail and so is not
> documented in the manual. So, yes, "package.loadlib" does record which
> shared libraries have been loaded. See the first lines of luaopen_package:
It would actually be quite a useful feature to have documented.
It allows a module that mainly does some bindings to test whether
the calling program has preloaded a possibly customized version
of some library that it then does not need to retrieve from some