[Extension] Arrays


#1

Hello you search arrays in GD5?
You can test this extension, it’s experimental, if you wish code it with me you are welcome!

Description:

This extension use the variables structures, that mean you can see the values in the debugger!
For now arrays are only on Objects.

You can:

  • Add value at the end of the array (Push)
  • Remove the first value in array (Shift)
  • Remove the last value at the end of the array (Pop)
  • Get length of the array
  • Reverse the array (Reverse)

I will add:

  • Add value at start of the array
  • Other suggestions ?

Download:

array_extension_0.0.1b.json - Download


#2

I only did a quick poke through this, but it looks really great.

Biggest suggestions:

  • Global Arrays
  • Scene Arrays
  • “For Each Entry in Array” style of event.

#3

+1 to @Silver-Streak suggestions.

My suggestion :

  1. action to sort array (ASC/DESC)
  2. Expressions to :
  • return the index of the higher value
  • return the index of the lower value
  • return the average
  • return the weighted average
  • dump the (whole) array as text (usefull for debugging/testing)

Here is my santa list :slight_smile:

Indeed great idea with this extension, i’ll test it in the evenning :slight_smile:


#4

This work like this ?

Yes i will add this one too!

I try to make functions before, and after i can extend the extension with global and scene variables.

No idea how to implement this one if someone want give a try…

Ready for next version


#5

I’m not sure @Bouh, here is a french explanation : https://www.educastream.com/statistiques-moyenne-simple-moyenne-ponderee-4eme

It’s a bit specific and i am not sure yet of how i would use it in game devlopment, but it’s really useful in statistics.


#6

Thats same operation.
See the code in action with values from your article:


#7

That isn’t possible as event functions haven’t access to the IDE and cannot declare events. Events can’t be declared through extensions for the time being anyways.


"Braid" time travel mechanic | GDevelop 5 tutorial