From 30c6fafdd81f10c37b3c6985488e4a57e0844119 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 2 Jun 2019 23:06:59 -0400 Subject: [PATCH] Fix global variables not being able to be used inside of a foreach$ loop. --- Engine/source/console/codeInterpreter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 186354869e..a899218e2e 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -2895,7 +2895,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) {