lua-users home
lua-l archive

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

In keeping with changes to the luaopen_x() calling semantics, I wonder
if API programmers might appreciate a heads-up in the HISTORY.  Even
just a one-liner reflecting that these luaopen_x functions must now be
called using lua_call.

Reference:  manual.html#5
To have access to these libraries, the C host program must call
luaL_openlibs, which open all standard libraries. Alternatively, it
can open them individually by calling luaopen_base (for the basic
library), luaopen_package (for the package library), luaopen_string
(for the string library), luaopen_table (for the table library),
luaopen_math (for the mathematical library), luaopen_io (for the I/O
and the Operating System libraries), and luaopen_debug (for the debug
library). These functions are declared in lualib.h and should not be
called directly: you must call them like any other Lua C function,
e.g., by using lua_call.

(I spent a day fighting with segfaults while converting an application
from LUA 5.0.2 to LUA 5.1rc and it turned out that luaopen_io(L) was
segfaulting on an undefined pointer.)