Lodash version
-
@reggaeguitar Maybe use _.uniq() instead?
-
lodash 4.17.11 would be great. It has many new functions.
-
It's not backward compatible though. That's a big problem.
-
Maybe the player can choose his version by something like:
Game.setLodashVersion('4.17.11');
which will reset the global context (if version changed) with the desired lodash version.
-
The problem is: game API and wrappers also rely on lodash, and API at least partially runs on the same IVM space as user code. Changing lodash version for user would likely also break those parts of the API.
-
@reggaeguitar You can distribute your own lodash version and do "global._ = ..." to initialise lodash. I did it for a while.
-
It's easy enough to ship a custom lodash version. In the past the size of a custom lodash was a problem but with 5M code limit it should be more doable now.
The local player version of lodash doesn't effect the engine. If you find somewhere it does, report a bug ... or send me a PM in slack.
-
@wtfrank Can you elaborate more please? Thanks for your response!
-
The game engine secretly sets up your global so that the variable global._ corresponds to the engine's copy of lodash.
You can put "global._ = require('lodash');" in your main.ts outside the loop, and add the latest lodash file to your source repository. This means that after a global reset, the engine-provided lodash is replaced with your own version.
-
@wtfrank The default lodash is also provided as a module named 'lodash'. To replace it you'd need to use a different name, like lodash4.