From 7f61395964a5b49961f6e4d7a1bdff2f44238860 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Tue, 30 Jul 2019 04:02:01 +0200 Subject: DTScopedVars: Add MapVar --- DTScopedVars.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'DTScopedVars.c') diff --git a/DTScopedVars.c b/DTScopedVars.c index 0cde670..3165553 100644 --- a/DTScopedVars.c +++ b/DTScopedVars.c @@ -4,10 +4,12 @@ static const ScopedVar_Global = 1; static const ScopedVar_Local = 2; static const ScopedVar_ArrayIndex = 3; +static const ScopedVar_MapIndex = 4; global func GlobalVar(name) { return [ScopedVar_Global, name]; } global func LocalVar(name, object target) { return [ScopedVar_Local, name, target || this]; } global func ArrayVar(index, array scopedVar) { return [ScopedVar_ArrayIndex, scopedVar, index]; } +global func MapVar(index, array scopedVar) { return [ScopedVar_MapIndex, scopedVar, index]; } global func &ScopedVar(array variable) { @@ -46,6 +48,11 @@ global func &ScopedVar(array variable) } return ScopedVar(variable[1])[index]; } + else if(variable[0] == ScopedVar_MapIndex) + { + var index = variable[2]; + return ScopedVar(variable[1])[index]; + } else { if(this) -- cgit v1.2.3-54-g00ecf