Closed TokcDK closed 2 years ago
so the correct way to iterate over an array in javascript is for..of
, not for..in
. that code is iterating over properties and isn't even doing a hasOwnProperty
check so it's looking at prototype properties as well. So it's iterating over every function supported by Array.prototype
. The functions here aren't zEdit functions, they're array extensions in the zEdit codebase.
Just use the fork.
Tried this patcher and got there errors for some spells.
Then put try catch and some debug output info and form log understood this line returns for some spells in Skyrim LE not only effect numbers but also function names and because patcher was failed on some spells. Example log after I put try catch and debug output for each i in effects in lines starting with "Checking":
I fixed the error with if (isNaN(i)) and maybe there is incorrect GetElements use but there is other functions list from here and below. I noticed that Length is displaying correct count and it can be fixed by use length but it still strange if effects elements returning function names after effect numbers. Noticed your fork and will use it but it still strange that 'for..in' returns function names.