[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: loading shared C library in Lua 5.1(beta)
- From: Tomas <tomas@...>
- Date: Fri, 25 Nov 2005 13:00:47 -0200 (BRST)
Hi,
I have several shared C libraries that I load for usage. By now, I do
this using the loadlib function which disapperead in Lua 5.1(beta).
Take a look at these messages:
http://lua-users.org/lists/lua-l/2004-09/msg00342.html
http://lua-users.org/lists/lua-l/2005-07/msg00001.html
http://lua-users.org/lists/lua-l/2005-07/msg00085.html
The first one is the original "package proposal" and the
other two are some modifications. `loadlib' changed to the `package'
table (section 5.3 of the Lua 5.1 beta manual).
If I
got it right, I have to use the require function to do this. So I set my
LUA_PATHs to the right directory and call reuqire.
Function `require' uses loadlib internally but there are
some details, as the name of the library initialization function,
that you have to pay attention.
1) Do I have to use require instead of loadlib ?
It is recommended.
2) If it is so, what further requirements do I have to consider?
There are some conventions you must follow. I think section
5.3 of the Lua 5.1 beta manual is the best source.
Tomas