Add read and read_sync methods
This commit is contained in:
parent
6cdf186b61
commit
86bfc7ad34
@ -24,11 +24,11 @@ impl lb_libfs {
|
|||||||
Self
|
Self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub extern "Lua" fn read(&self, path: string) -> string {
|
pub async extern "Lua-C" fn read(&self, path: &str) -> io::Result<Vec<u8>> {
|
||||||
self.__read(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
async extern "Lua-C" fn __read(&self, path: &str) -> io::Result<Vec<u8>> {
|
|
||||||
fs::read(path).await
|
fs::read(path).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub extern "Lua-C" fn read_sync(&self, path: &str) -> io::Result<Vec<u8>> {
|
||||||
|
std::fs::read(path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user