lua-users home
lua-l archive

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


Hi,

if your application has hard-linked Lua modules (not in external library files), then their name and initialisation function should go into the preloadedlibs array in linit.c, such that  package.preload() can find them:

static const luaL_Reg preloadedlibs[] = {
  {"socket.core", luaopen_socket_core},
  {"mime.core",   luaopen_mime_core},
  {"lfs",         luaopen_lfs},
  {"md5.core",    luaopen_md5_core},
  {"zlib",        luaopen_zlib},
  {NULL, NULL}
};

--
Oliver

Am 12.08.2015 um 05:17 schrieb Nan Xiao:
Hi all,

After reading require section, I am a little confused about the function of package.preload, and it seems
that package.loaded is enough.

Why does Lua provide package.preload? Is there any special usage function?

Thanks in advance!

Best Regards
Nan Xiao