slang_backend/
native.rs

1use crate::value::Value;
2
3/// Built-in function to print a value
4///
5/// ### Arguments
6///
7/// * `args` - Arguments to the function (should be exactly 1)
8///
9/// ### Returns
10///
11/// Success with i32(0) if successful, or an error message
12pub fn print_value(args: &[Value]) -> Result<Value, String> {
13    if args.len() != 1 {
14        return Err("print_value expects exactly 1 argument".to_string());
15    }
16
17    println!("{}", args[0]);
18
19    // Return 0 to indicate success
20    Ok(Value::I32(0))
21}