Goombert
|
|
Posted on: October 10, 2014, 02:42:33 am |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I was going to do a little something, and realized that arrays were fixed. I can't quite recall who or what fixed them or when they did it, but they do seem to work now.
The following builds fine for me on the latest master.
var ass; ass[0] = 69;
show_message(string(ass[0]));
Whoever it was, thank you!
Additionally that thing I was trying to do was provide an array length function, but sadly JDI fails to parse the templates, it keeps saying the function is undefined unless I change the parameter
template <unsigned array_size> unsigned array_length_1d(variant (&v)[array_size]);
|
|
« Last Edit: October 10, 2014, 02:45:39 am by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
egofree
|
|
Reply #1 Posted on: October 10, 2014, 03:46:29 am |
|
|
Joined: Jun 2013
Posts: 601
|
I think nobody fixed the arrays. It was always possible to declare arrays with var. The problem is that it's possible to use arrays only with var type. Currently it's not possible to declare strongly type arrays. In the past i updated already the wiki : Arrays
An array is always declared as a variant data type with the keyword var, followed by its name. http://enigma-dev.org/docs/Wiki/ENIGMA:Specification
|
|
« Last Edit: October 10, 2014, 04:08:11 am by egofree »
|
Logged
|
|
|
|
|
Goombert
|
|
Reply #3 Posted on: October 10, 2014, 06:31:25 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Do you have any ideas on implementing array length sorlok? I was wanting to add some like sprite_getpixels and surface_getpixels or even d3d_model_vertices(var vertices[]) functions that return an array to avoid multiple bindings for each pixel. Without JDI supporting collections in EDL yet and me not wanting the functions to rely on the data structure extension, we are left with returning arrays. But they are unusable if the user can not get the array dimensions with the Studio function.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
|
|
|
|
|
sorlok_reaves
|
|
Reply #10 Posted on: October 13, 2014, 12:19:46 pm |
|
|
Joined: Dec 2013
Posts: 260
|
Oh ok thanks for refreshing my memory Harri, indeed....I am used to the C++ arrays, I remembered we could not use those in ENIGMA sadly..... Imagine if we could though, would this require a massive change ? Sorlok For now I'm looking into the array length questions. Local primitive arrays shouldn't be too difficult, but reclaiming the memory when it becomes unused is a little trickier. Does GM:S offer "local int arr[255]"? I'm not familiar with the syntax, but then again most of my work is with GM 5.
|
|
|
Logged
|
|
|
|
|
|
|
|
|