-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing array extension methods for Sugar #64
Comments
The new implementation adds to the Sugar story format two VarType services (the Cradle way of extending StoryVar) for array (List) and object (Dictionary). So now you do things like To overcome JavaScript to C# API incompatibility, extension methods were added that polyfill things like concat, pluck, etc. as well as some common JavaScript methods like toString(). The previous implementation that used arrayGet, objSet etc. has been removed - BREAKING CHANGE. The only thing that remained is the requirement to instantiate variable of these types like this: For array: For object: |
To preview the use of these extensions before the develop branch is merged with master, download the following files and place them anywhere in your project: And then add these 2 lines somewhere before you call story.Begin:
|
Hi! Thanks for doing this! It did not work out fo the box, unfortunately. Should I also change js extensions accordingly? https://github.com/daterre/Cradle/blob/master/Editor/js/StoryFormats/Sugar/sugar.extensions.js_ |
StoryVarExtensions needed minor fix on line 254 (Max to Min). Likely the same issue for the other operations? Now I'm stuck with lack of vars capturing support in my story, unfortunately, which is technically out of the scope for this arrays issue. I'll try to simplify my example and let you know. Here's the example BTW, if you're aware of a better way to generate links from changing arrays so it works with Cradle, I'd appreciate that.
|
Hey mate, anything I could help with? |
Hey, sorry left you hanging, if you have any fixes/additions I'd really appreciate a pull request - this task is really hard to complete with the short time slots I have to work on Cradle. |
https://www.motoslave.net/sugarcube/2/docs/object-methods.html#array-arrayprotopluckmany
The text was updated successfully, but these errors were encountered: