Jump to content
  • 0

Returning array as variable


ViktorReznov

Question

4 answers to this question

Recommended Posts

  • 0

So you want to use an unknown array as variable to use it in further code? Am I right there?

Could you explain why you need that? Maybe there is an easier solution. I only know that you can get the name of an array by sending it to an eventhandler. Just try to explain what you are trying to do.

Link to comment
Share on other sites

  • 0

array1 = [some stuff in here]

array2 = [some other stuff]

array3 = [array1 + array2]

cursortarget returns true that class is indeed in array3

now I want to extract which array it really came from and use that array name as a variable to determine other code

it was an original overdrawn thought to getting a vehicles class name from an all encompassing target array solely for cursorTarget purposes and then wanted to use subclass arrays to have different addAction effects using the name of the subclass array as a variable. (it honestly made more sense in my head at the time but that was some powerful lack of sleep)

I have since figured out another way to achieve what I wanted but I am curious as to if it is possible to do?

Thanks for your time m8

Link to comment
Share on other sites

  • 0
2 hours ago, JasonTM said:

_object = cursorTarget;

if(isNull _object) exitWith {};

if(_object in array1) then {

your code here

);

if(_object in array2) then {

your code here

);

if(_object in array1 && _object in array2) then {

your code here

);

 

Thanks for the response mate! Its basically what i ended up doing. I believe I was overcomplicating it in my thought process

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...