fix `for` statement to use script-local vars in global scope

fixes [https://github.com/luke-gru/riml/issues/27]