Closed
Description
I'm looking for a way to preload libraries so they can be included in a script via require
. This comment in linit.c
describes what I'm trying to do:
** You can also *preload* libraries, so that a later 'require' can
** open the library, which is already linked to the application.
** For that, do the following code:
**
** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
** lua_pushcfunction(L, luaopen_modname);
** lua_setfield(L, -2, modname);
** lua_pop(L, 1); // remove PRELOAD table
I thought about writing in the functionality myself but after reading this issue (#105), it looks like it might be a little trickier than I thought. I'm not well-versed in the internals of Lua, I'm hoping someone might have some insight on how to go about this.
Metadata
Metadata
Assignees
Labels
No labels