Skip to main content

FileLoaderHook

Type Alias FileLoaderHook 

Source
pub type FileLoaderHook = fn(filename: &[u8]) -> Result<Vec<u8>, LuaError>;
Expand description

Function-pointer signature for reading a file’s full contents into memory, installed on GlobalState::file_loader_hook by the embedder.

std::fs is banned outside lua-cli, so lua-stdlib’s loadfile and searcher_lua reach the filesystem via this hook. None keeps the file system unreachable, which is appropriate for embeddings where modules are served exclusively from package.preload.