Expand description
Dynamic library loader for the Lua package library.
Ported from reference/lua-5.4.7/src/loadlib.c (758 lines, ~25 functions).
Provides require, package.loadlib, package.searchpath, and the four
built-in module searchers (preload, Lua-file, C-library, C-root).
§Platform-specific dynamic loading
The three platform calls (lsys_load, lsys_sym, lsys_unloadlib) are
dispatched through embedder hooks on lua_vm::state::GlobalState:
dynlib_load_hook, dynlib_symbol_hook, dynlib_unload_hook. lua-cli
installs a libloading-backed implementation; embeddings that omit the
hooks behave like C-Lua’s fallback platform stub (LIB_FAIL = "absent").
Keeping the platform calls behind hooks lets lua-stdlib stay free of
unsafe per PORTING.md §1; libloading lives entirely in lua-cli.
Functions§
- ll_
loadlib package.loadlib(filename, funcname)— open a C library and return a Lua-callable wrapper forfuncname.- ll_
require require(modname)— load a module by name, usingpackage.loadedas a cache andpackage.searchersto find and load it if not already cached.- ll_
searchpath package.searchpath(name, path [, sep [, rep]]).- luaopen_
package - Open the
packagelibrary and return thepackagetable.