Closed chaosprint closed 5 months ago
guess there is sth wrong with sin(PI)
It's the PI
as replacing PI
with 0.1
doesn't crash the engine
Yup, with the current features rhai is used, using this code:
use rhai::{Engine, EvalAltResult};
pub fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<f32>("PI")?;
println!("Answer: {result}");
Ok(())
}
I get Error: ErrorVariableNotFound("PI", 1:1)
EDIT: To fix it, you have to call it like a function:
use rhai::{Engine, EvalAltResult};
pub fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<f32>("PI()")?;
println!("Answer: {result}");
Ok(())
}
and I've verified that this works in glicol today.