Jump to content
jibun

_forEachIndex is null

Recommended Posts

When i do something like this:

{_array set [_forEachIndex, _x + 1]} forEach _array

It throws me an "Type Any expected Number" error.

After further investigation i revealed that _forEachIndex is scalar bool array string 0xfcffffef, which means that there's no variable named _forEachIndex.

How to fix it?

Share this post


Link to post
Share on other sites

Just noticed this is for arma 1. the _forEachIndex maybe isn't available for that game

wiki

Share this post


Link to post
Share on other sites
15 minutes ago, gc8 said:

What's in _array?

Coordinates.

 

12 minutes ago, gc8 said:

Just noticed this is for arma 1. the _forEachIndex maybe isn't available for that game

wiki

My bad, thought that it should be available in OFP aswell since there is no remarks saying that _forEachIndex is present since ArmA 1/2/3 and not available in OFP.

 

Share this post


Link to post
Share on other sites
On 30.9.2018 at 6:33 AM, prototype1479 said:

you need to use _x instead of _foreachindex

That doesn't make sense. _x and _forEachIndex are completely different things.

And if you look at his code you'll see that _x won't work.

Share this post


Link to post
Share on other sites

Well don't you have to use _x in OFP if you are using foreach command?

 

His code is hella flawed yeah I know he really needs to give more info about what are these arrays and variables.

 

But he probably figured out by now

Share this post


Link to post
Share on other sites
19 hours ago, prototype1479 said:

His code is hella flawed yeah I know he really needs to give more info about what are these arrays and variables.

Well according to his code he wants to increment each number in the array.

Solution would probably be to just use a normal for loop then.

 

19 hours ago, prototype1479 said:

Well don't you have to use _x in OFP if you are using foreach command?

_x is the element that's currently being iterated over yeah... But you don't HAVE TO use it.

Share this post


Link to post
Share on other sites
18 hours ago, prototype1479 said:

You mean no one has to use _x in foreach or he only?

No one. You can do whatever you want in there.

  • Confused 1

Share this post


Link to post
Share on other sites
_i=0; {_array set [_i _x + 1]; _i=_i+1} forEach _array

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×