Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 6 of 6

Thread: Converting a JSArray to an SCArray

  1. #1
    Senior Member
    Join Date
    Apr 2007
    Posts
    160

    Default Converting a JSArray to an SCArray

    Hi all,

    Is it possible to convert a JS Array to an SC Array?

    If so, what is the syntax please.

    Cheers

  2. #2
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    714

    Default

    Why do you need to convert it? If the array is what you're returning to an SC function (or setting in a RAD variable), you can return a JS Array and it will be implicitly converted.

  3. #3
    Senior Member
    Join Date
    Apr 2007
    Posts
    160

    Default

    Hiya glg,

    I had an idea on some coding that I was doing and wasn't too sure if you can only use JS funcitons on JS datums and SC functions on SC datums.

    If that was the case I was converting an SC array to a JS array, manipulating the values and then realised that I needed to use an SC function. So I thought I'd have to convert it back to an SC array and do the SC functions.

    Is this not the case?

    Cheers

  4. #4
    Senior Member mateuszk's Avatar
    Join Date
    Nov 2006
    Posts
    302

    Default

    Nope, if the JS array is "homogenic" and the data type for items hasn't changed
    plain assignment should do the trick.

    i.e. probsum.assignment = jsAssignmentArr;

  5. #5
    Senior Member
    Join Date
    Apr 2007
    Posts
    160

    Default

    Hi Mateuszk,

    Thanks for the reply but it made no sense to me Even looking up the word "homogenic" the result was an album from Bjork hee hee.

    Can you please explain that in "layman's terms"

    Cheers

  6. #6
    Senior Member mateuszk's Avatar
    Join Date
    Nov 2006
    Posts
    302

    Default

    Sure, using that word might be too much, you're right.
    http://www.merriam-webster.com/medical/homogenic

    What I meant is, when an array has all the items of the same type (String, Number etc.).
    In SC/SM an array can't have mixed types, in JS no problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts