problem compiling array in a module
BlitzMax Forums/BlitzMax Programming/problem compiling array in a module
| ||
I've made a module with this function Function AmbientLight( R, G, B) Local ambL#[4] ambL#(0)=(R*5)/255 ambL#(1)=(G*5)/255 ambL#(2)=(B*5)/255 ambL#(3)=1 glLightfv(GL_LIGHT0, GL_AMBIENT, ambL) End Function and when I compile, I've got this error message Compiling:engine.bmx [ERROR]: Compile Error:Expression of type 'Float Array' cannot be invoked [ERROR]: [e:\blitzmaxbeta103\mod\tess.mod\engine.mod/engine.bmx;1027;2] [ERROR]: Build Error: failed to compile e:/blitzmaxbeta103/mod/tess.mod/engine.mod/engine.bmx I really don't understand, if someone can help me! ;) |
| ||
You need to use square brackets to access array elements not parenthesies. eg: array[0]=value Not array(0)=value |
| ||
The error text is just a little cryptic =) |
| ||
I think what Robert said is right, that is the problem, but it would be nice if you could tell us which line is line 1027. That is where it says the error is, so we could probably help if you tell us which one it is. But yes, you need square brackets [ ] not parenthesis for accessing arrays. |