Allow getting nested map values
This commit is contained in:
parent
47cc649f8d
commit
fda852f69a
@ -85,8 +85,18 @@ impl VariableMap {
|
||||
|
||||
impl Context for VariableMap {
|
||||
fn get_value(&self, identifier: &str) -> Option<&Value> {
|
||||
let split = identifier.split_once(".");
|
||||
if let Some((map_name, next_identifier)) = split {
|
||||
let value = self.variables.get(map_name)?;
|
||||
if let Value::Map(map) = value {
|
||||
map.get_value(next_identifier)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
self.variables.get(identifier)
|
||||
}
|
||||
}
|
||||
|
||||
fn call_function(&self, identifier: &str, argument: &Value) -> EvalexprResult<Value> {
|
||||
match identifier {
|
||||
|
Loading…
Reference in New Issue
Block a user