import std::fs::File

This commit is contained in:
Andy Weidenbaum 2021-02-27 09:15:54 +11:00
parent cf3a90faca
commit 8e25481811

View File

@ -1,6 +1,7 @@
use rlua::prelude::LuaError;
use rlua::{Context, MetaMethod, RegistryKey, Table, UserData, UserDataMethods, Value};
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::Path;
@ -108,7 +109,7 @@ where
};
let mut content = String::new();
let mut file = std::fs::File::open(path)
let mut file = File::open(path)
.map_err(|e| LuaError::RuntimeError(format!("io error: {:#?}", e)))?;
file.read_to_string(&mut content)
.map_err(|e| LuaError::RuntimeError(format!("io error: {:#?}", e)))?;