lua-users home
lua-l archive

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


Hi Daurnimator,

Got it! Thanks very much!

Best Regards
Nan Xiao

On Tue, Aug 4, 2015 at 9:35 AM, Daurnimator <quae@daurnimator.com> wrote:
On 4 August 2015 at 11:18, Nan Xiao <xiaonan830818@gmail.com> wrote:
> Hi all,
>
> I am reading an old Lua project, and come across "luaL_openlib" function. I
> try to find it in
> 5.0 manual, but nothing can find. In 5.1, only "Function luaL_openlib was
> replaced
> by luaL_register." is found.
>
> Where can I get the official document of "luaL_openlib" function? Such as
> prototype,
> how to use, etc.
>
> Thanks very much in advance!
>
> Best Regards
> Nan Xiao

IIRC, back in the 5.0 days the auxiliary library (functions starting
with luaL) wasn't documented.
You can see the luaL_openlib source here:
http://www.lua.org/source/5.0/lauxlib.c.html#luaL_openlib

It's the same as luaL_register in 5.1, but with an extra 'nup'
parameter that allows adding upvalues.
http://www.lua.org/manual/5.1/manual.html#luaL_register

The 'nup'  parameter works the same as Lua 5.2's luaL_setfuncs;
(luaL_setfuncs is just like luaL_register without the 'libname' parameter.)
http://www.lua.org/manual/5.2/manual.html#luaL_setfuncs