Java Script <> Ruby array transfer
-
Hi all,
I have heard it is possible to transfer JS arrays to Ruby and back.
Could someone show me how to do it, please?<script language = "JavaScript"> tellSketchup(list) function tellSketchup(value) {window.location='skp;ValueChanged@'+value;}'list' is an array. It is being passed to tellSketchup function.
dlg.add_action_callback("ValueChanged") {|d,mats|;puts mats.class;dlg.close}Code above returns string.
Tomasz
-
Everything needs to passed as a string. See the link.
-
Thanks Jim for such a fast response! I was sure I have seen a video from SU API conference by Google and they mentioned arrays as well.. but it seems I am wrong.
Tomasz
EDIT:
On the same page I have found following :
@unknownuser said:
Looking ahead: Using JSON for more complex data....It's a way where you can pass nested objects and arrays in a single command.
-
Yes, JSON is how you do it.
-
I was just looking at ruby-json. I noticed there were 2 ways to use it: one c-language extension, and one called "pure". Unfortunately, the "pure" is not so pure. It requires platform specific libraries also.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement