summaryrefslogtreecommitdiff
path: root/src/library/extend.rs
blob: 6396274e031257940e6d3684af70d04065627b3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::prelude::*;

/// `type`: Find out the name of a value's type.
///
/// # Positional arguments
/// - Any value.
///
/// # Return value
/// The name of the value's type as a string.
pub fn type_(ctx: &mut EvalContext, args: &mut ValueArgs) -> Value {
    if let Some(value) = args.require::<Value>(ctx, "value") {
        value.type_name().into()
    } else {
        Value::Error
    }
}