How to define foreach function for new version
#1

Hello, I am trying to update my YSI includes and I got some warnings 'like warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level'
My question in how to define Foreach(Player, i) to Foreach(new i : Player)?Is this possible?
I tried this:
#define foreach(%0, %1) foreach(new %1 : Player) but don't work. I have to define it becouse my gamemode doesn't called all variables "i".
Thanks in advance
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
You need to replace the (10 year) old code with the new version. The variable name doesn't matter.
I did it in a hour(hoped to find an easy way than to use Replace All editor function for each changed variable than "i")
anyway thanks
rep
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
regex replace?

foreach\s*\((\w+),\s*(\w+)\)

foreach(new $2 : $1)
Oh, thank you, you saved my time
I really didn't knew about regular expressions and regex replaces until now
Thanks again!

But I have a (small) problem:
when I replace with my edtitor with this code, it replaces without round brackets(foreachnew i : Player)
I use notepad++ editor. Can be an editor bug or smth?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)