Plugin to manipulate an array

  • I'm trying to write a plugin which receives three parameters: width, height and a reference to an array.

    I have an action which, based on width and height, should manipulate the array. However, I can't figure out how to write to the array.

    I tried

    Acts.prototype.Generate = function (width, height, array)
    {
       array.set(2, 3, 44);
    };[/code:a06dzfw6]
    which doesn't work, as 'array' doesn't expose the array methods.
    What I am missing?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Unfortunately, you cant pass an array as a parameter as C2 does not support passing objects such as arrays, vectors etc... . For now you can only pass ints, floats, strings, instances or keyboard virtual keys.

  • Here is a plugin to reset official array by a csv string.

  • X3M Thank you, I see. I ended up forking the official array plugin and adding the needed functionality with a new method. Neither elegant nor clean, but it does the job.

    rexrainbow I tried to understand in the code how you link to the array, but it seems to be beyond my JS skills... Thank you anyway, I hop to find some time to study the source code of your plugins, I guess I can learn a lot.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)