소스 검색

Merge pull request #327 from lukaspj/fix/interpreter-foreach

Fix global variables not being able to be used inside of a foreach$ loop
Brian Roberts 5 년 전
부모
커밋
6dedf6330b
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  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)
    {