Closed Frotty closed 5 years ago
The 14k I referred to was the global var limit, not the function-scope local limit.
The latter I have no idea about, unfortunately.
One interesting thing is that global var limit seems to result in map loading with no script, while local limit causes a crash
Don't know if these problems are connected but for me the same UnitAnimations package is broken as well - independent of optimizations enabled or not. The errors says that named are duplicated. Names such as Vulture and other (to me random) names within that same package. Making my whole non-compilable at the moment.
The duplicate names should already be fixed if you use the latest version of the library.
That's really strange because I just updated it right before that. Maybe something went wrong. I will probably just completely reinstall Wurst as a whole and notify you about the results later.
edit: Thanks @peq , upgrading was indeed broken so I had two wrong versions of WurstScript installed at the same time. completely uninstalled and reinstalled WurstScript and everything works again.
Okay I fixed it by removing garbage not only before but also after flattening.
This is also done by -opt
param which is why it worked with that.
So output is now fixed, but still slow as molasses.
A quick preprocessor that checks if imported packages are actually referenced by any package, before doing a complete parse, could at least address the issue when not using the package.
Without optimizations (specifically .removeGarbage() function) the script is more than double the size (60k vs 26k lines) because it contains an almost 30k lines long function
init_UnitAnimations
which only sets local variables. Since these are >20k locals, it most likely hits the maximum locals allowed per function limit, which is around 14k as stated by @Cokemonkey11 .I don#t even use the UnitAnimations package, but it is imported due to the public import from the Assets package.