Pages: 1
Author Topic: 2D multi-dimensional arrays  (26,826 Views)
Offline (Unknown gender) egofree

Contributor
Joined: Jun 2013
Posts: 601
View profile
Posted on: February 03, 2014, 03:25:04 PM
Hello,

I would like to know if two dimensional arrays are supported in ENIGMA. I tried to use the following code:

int jump_path [1][1];
jump_path[1,1] = 1;


or

int jump_path [1][1];
jump_path[1][1] = 1;


But i've the same following error message:

QuoteIn file included from SHELLmain.cpp:102:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_scr_0(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:34:17: error: 'jump_path' cannot be used as a function
   jump_path(1, 1)= 1;

Am i doing something wrong ?
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #1 Posted on: February 03, 2014, 03:31:19 PM
This appears to be a compiler issue because if I run the following code.
Code (EDL) Select

var myarray[1];

myarray[0] = 0;


I get this error message.
Quote from: Progress Frame
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:37:14: error: 'myarray' cannot be used as a function
     myarray(0)= 0;
              ^
mingw32-make.exe[1]: Leaving directory

Indicating that JDI for some reason parsed it out into a function call. So no it wasn't your fault at all egofree, the compiler turned your code in C++ and thought it was a function call.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #2 Posted on: February 03, 2014, 04:19:38 PM
Those have been broken for some time due to type resolution in the old compiler, which is hacky at best. Most of my focus in JDI was for the purpose of correctly coercing C++ expressions.

I should mention that var has GM-like matrix capabilities. [snip=EDL]var myvar; myvar[10,20] = "Your value";[/snip]
Pages: 1