added "for each k:v in .. do .." statement

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1174 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-27 13:06:24 +00:00
parent f510a35647
commit 9abfdd171c
7 changed files with 128 additions and 59 deletions
+14
View File
@@ -101,6 +101,20 @@ ScriptValueP Context::eval(const Script& script, bool useScope) {
}
break;
}
// Loop over a container, push next key;next value or jump
case I_LOOP_WITH_KEY: {
ScriptValueP& it = stack[stack.size() - 2]; // second element of stack
ScriptValueP key;
ScriptValueP val = it->next(&key);
if (val) {
stack.push_back(val);
stack.push_back(key);
} else {
stack.erase(stack.end() - 2); // remove iterator
instr = &script.instructions[i.data];
}
break;
}
// Make an object
case I_MAKE_OBJECT: {
makeObject(i.data);