Explorar o código

Fix global variables not being able to be used inside of a foreach$ loop.

Jeff Hutchinson %!s(int64=6) %!d(string=hai) anos
pai
achega
2bf3c8384c
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      Engine/source/console/codeInterpreter.cpp

+ 4 - 1
Engine/source/console/codeInterpreter.cpp

@@ -2898,7 +2898,10 @@ OPCodeReturn CodeInterpreter::op_iter_begin(U32 &ip)
 
    IterStackRecord& iter = iterStack[_ITER];
 
-   iter.mVariable = gEvalState.getCurrentFrame().add(varName);
+   if (varName[0] == '$')
+      iter.mVariable = gEvalState.globalVars.add(varName);
+   else
+      iter.mVariable = gEvalState.getCurrentFrame().add(varName);
 
    if (iter.mIsStringIter)
    {