summaryrefslogtreecommitdiffstats
path: root/DTScopedVars.c
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2019-07-30 04:02:01 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2019-07-30 04:02:01 +0200
commit7f61395964a5b49961f6e4d7a1bdff2f44238860 (patch)
treef84b354d6506105ab034c3b6b6d1052cd5dbb219 /DTScopedVars.c
parent7573bd9698d7ed6fef01a166e9f188e0ed0eb75f (diff)
downloadSystem.c4g-7f61395964a5b49961f6e4d7a1bdff2f44238860.tar.gz
System.c4g-7f61395964a5b49961f6e4d7a1bdff2f44238860.zip
DTScopedVars: Add MapVar
Diffstat (limited to 'DTScopedVars.c')
-rw-r--r--DTScopedVars.c7
1 files changed, 7 insertions, 0 deletions
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)