lua-users home
lua-l archive

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


2015-02-09 13:52 GMT+02:00 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> I mean something that was loaded using "package.loadlib".
>
> 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".

$ lua
Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> R=debug.getregistry()
> for k,v in pairs(R) do if type(k)=="userdata" and type(v)=="table" then
>>   key=k; val=v;
>> end end
> for k,v in pairs(val) do print(k,v) end -- nothing printed, `val` is empty
> package.loadlib("/usr/lib/libzip.so.2","*")
true
> for k,v in pairs(val) do print(k,v) end -- something printed now
1    userdata: 0x1d1edd0
/usr/lib/libzip.so.2    userdata: 0x1d1edd0