Discussion:
Where can I get the official introduction of "luaL_openlib" function?
Nan Xiao
2015-08-04 01:18:04 UTC
Permalink
Hi all,

I am reading an old Lua project, and come across "luaL_openlib" function. I
try to find it in
5.0 manual <http://www.lua.org/manual/5.0/manual.html>, but nothing can
find. In 5.1 <http://www.lua.org/manual/5.1/manual.html>, 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
Daurnimator
2015-08-04 01:35:16 UTC
Permalink
Post by Nan Xiao
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
Nan Xiao
2015-08-05 03:23:33 UTC
Permalink
Hi Daurnimator,

Got it! Thanks very much!

Best Regards
Nan Xiao
Post by Nan Xiao
Post by Nan Xiao
Hi all,
I am reading an old Lua project, and come across "luaL_openlib"
function. I
Post by Nan Xiao
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.
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
Loading...