forked from StrafesNET/strafe-client
Add color_print crate and implement it into the Lua error handler
This commit is contained in:
parent
88ad707f39
commit
b5f7a8cc6f
38
Cargo.lock
generated
38
Cargo.lock
generated
@ -368,6 +368,27 @@ dependencies = [
|
|||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color-print"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a858372ff14bab9b1b30ea504f2a4bc534582aee3e42ba2d41d2a7baba63d5d"
|
||||||
|
dependencies = [
|
||||||
|
"color-print-proc-macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "color-print-proc-macro"
|
||||||
|
version = "0.3.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57e37866456a721d0a404439a1adae37a31be4e0055590d053dfe6981e05003f"
|
||||||
|
dependencies = [
|
||||||
|
"nom",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "com"
|
name = "com"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -1029,6 +1050,12 @@ dependencies = [
|
|||||||
"paste",
|
"paste",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "minimal-lexical"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mlua"
|
name = "mlua"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
@ -1117,6 +1144,16 @@ dependencies = [
|
|||||||
"memoffset",
|
"memoffset",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom"
|
||||||
|
version = "7.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"minimal-lexical",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.17"
|
version = "0.2.17"
|
||||||
@ -1703,6 +1740,7 @@ name = "strafe-client"
|
|||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"color-print",
|
||||||
"configparser",
|
"configparser",
|
||||||
"ddsfile",
|
"ddsfile",
|
||||||
"glam",
|
"glam",
|
||||||
|
@ -7,6 +7,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytemuck = { version = "1.13.1", features = ["derive"] }
|
bytemuck = { version = "1.13.1", features = ["derive"] }
|
||||||
|
color-print = "0.3.5"
|
||||||
configparser = "3.0.2"
|
configparser = "3.0.2"
|
||||||
ddsfile = "0.5.1"
|
ddsfile = "0.5.1"
|
||||||
glam = "0.24.1"
|
glam = "0.24.1"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use mlua::{Lua as Luau, Result, Table};
|
use mlua::{Lua as Luau, Result, Table};
|
||||||
use glam::{Vec2, Vec3, Vec4, Quat};
|
use glam::{Vec2, Vec3, Vec4, Quat};
|
||||||
|
use color_print::cprintln;
|
||||||
|
|
||||||
const STRAFE_VERSION: &str = env!("CARGO_PKG_VERSION");
|
const STRAFE_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
@ -216,7 +217,7 @@ impl Luavm for StrafeluaGlobals {
|
|||||||
pub fn error_wrapper(execute_result: Result<()>) {
|
pub fn error_wrapper(execute_result: Result<()>) {
|
||||||
match execute_result {
|
match execute_result {
|
||||||
Ok(t) => t,
|
Ok(t) => t,
|
||||||
Err(e) => println!("[StrafeLua ERROR]: {}", e),
|
Err(e) => cprintln!("[StrafeLua ERROR]: <red>{}</red>", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,6 @@ pub fn default_models()->model::IndexedModelInstances{
|
|||||||
|
|
||||||
fn main(){
|
fn main(){
|
||||||
let strafelua_vm = luau::new_state(true).expect("Failed to load strafe lua");
|
let strafelua_vm = luau::new_state(true).expect("Failed to load strafe lua");
|
||||||
// luau/tests/Vector.lua
|
|
||||||
luau::error_wrapper(strafelua_vm.load(r#"
|
luau::error_wrapper(strafelua_vm.load(r#"
|
||||||
--Purposely throw an error
|
--Purposely throw an error
|
||||||
Squidward()
|
Squidward()
|
||||||
|
Loading…
Reference in New Issue
Block a user