Skip to main content

FileRemoveHook

Type Alias FileRemoveHook 

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

Function-pointer signature for removing a file, installed on GlobalState::file_remove_hook by the embedder.

std::fs is banned outside lua-cli, so lua-stdlib’s os.remove reaches the filesystem via this hook. Returns Ok(()) on success.

The error type is std::io::Error so os.remove’s failure triple (nil, msg, errno) can report the real raw_os_error() — see FileOpenHook’s doc for why LuaError cannot carry it (#301).