Support for errors from scripts through separate script error handling.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-21 10:35:46 +02:00
parent a6f4b1d5c5
commit eb68977290
9 changed files with 677 additions and 222 deletions

View File

@@ -1,6 +1,17 @@
use std::ffi::{c_char, CString};
/// The foreign function interfaces for the turn choices
mod choices;
/// The foreign function interfaces for the dynamic data libraries
mod libraries;
/// The foreign function interfaces for the dynamic data models
mod models;
/// The library the battle uses for handling.
#[no_mangle]
#[allow(clippy::unwrap_used)]
extern "C" fn set_script_error_handler(func: unsafe extern "C" fn(*mut c_char)) {
crate::dynamic_data::set_script_error_handler(Box::new(move |e: &anyhow_ext::Error| unsafe {
func(CString::new(e.to_string()).unwrap().into_raw())
}));
}