Skip to content
Snippets Groups Projects
Commit af7bb8f2 authored by Louis's avatar Louis :fire:
Browse files

Fix cargo check errors

parent 8695ebf1
No related branches found
No related tags found
1 merge request!2Scripting
use routing::request;
use server::LuaRuntime;
use rlua::{Lua};
use scripting::{run_script, ScriptResponse};
......@@ -38,4 +37,4 @@ impl <'form> FromForm<'form> for ScriptParams {
pub fn route_script(params: ScriptParams, runtime: LuaRuntime) -> ScriptResponse {
let lua: Lua = runtime.into();
run_script(format!("example/.swerve/{}", params.script_name), &lua, params.script_params).unwrap_or_else(|| ScriptResponse::default())
}
\ No newline at end of file
}
......@@ -2,11 +2,11 @@ use std::convert::AsRef;
use std::path::Path;
use std::fs::File;
use std::io::Read;
use rlua::{Lua, UserData};
use rlua::Lua;
use scripting::ScriptResponse;
use std::collections::HashMap;
pub fn run_script<P: AsRef<Path>>(path: P, mut lua: &Lua, params: HashMap<String, String>) -> Option<ScriptResponse> {
pub fn run_script<P: AsRef<Path>>(path: P, lua: &Lua, params: HashMap<String, String>) -> Option<ScriptResponse> {
let mut file = File::open(&path).unwrap();
let mut buf = String::new();
......
use rlua::{UserData, UserDataMethods, Table};
use rlua::{UserData, UserDataMethods};
use rocket::Request;
use rocket::http::Status;
use rocket::response::{Response, Responder, ResponseBuilder};
use rocket::response::{Response, Responder};
use std::io::Cursor;
use std::default::Default;
......@@ -58,4 +58,4 @@ impl <'r>Responder<'r> for ScriptResponse {
}
r.ok()
}
}
\ No newline at end of file
}
use rlua::{Lua, Result as LuaResult, FromLua};
use rlua::{Lua, Result as LuaResult};
use rocket::{Outcome, http};
use rocket::request::{FromRequest, Request};
use std::convert::{Into, AsRef, AsMut};
use scripting;
use serde::Serialize;
use std::collections::HashMap;
use scripting;
const LIB_JSON_ENCODE: &'static str = include_str!("../scripts/json.lua");
......@@ -74,4 +73,4 @@ pub fn create_runtime(with_debug: bool) -> LuaResult<LuaRuntime> {
}
Ok(LuaRuntime(runtime))
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment