Add read and read_sync methods

This commit is contained in:
lumi 2025-06-25 18:42:40 +10:00
parent 6cdf186b61
commit 86bfc7ad34
Signed by: luaneko
GPG Key ID: 406809B8763FF07A

View File

@ -24,11 +24,11 @@ impl lb_libfs {
Self
}
pub extern "Lua" fn read(&self, path: string) -> string {
self.__read(path)
}
async extern "Lua-C" fn __read(&self, path: &str) -> io::Result<Vec<u8>> {
pub async extern "Lua-C" fn read(&self, path: &str) -> io::Result<Vec<u8>> {
fs::read(path).await
}
pub extern "Lua-C" fn read_sync(&self, path: &str) -> io::Result<Vec<u8>> {
std::fs::read(path)
}
}