Jump to content
Sign in to follow this  
twirly

Embed a function in a script?

Recommended Posts

Hi...anyone know the correct syntax for embedding a function in a script?

For example I've tried this construct...

fnAdd = {

  private ["_num1","_num2","_num3"];

  _num1 = _this select 0;
  _num2 = _this select 1;
  _num3 = _num1 + _num2;

  _num3

};

.....and then later on in the script......

_num = [2,2] call fnAdd;

Doesn't work!

I've seen it before in lots of code (I think!)....but for the life of me can't seem to open an sqf with what I'm looking for. Still searching though. :confused:

Edit: Problem solved! That is the correct code above.....My script was a little more complicated that that.

Writing it out there in a simple form actually helped! Hahah...Therepy!

Edited by twirly

Share this post


Link to post
Share on other sites
I suppose this won't help you, but your script works for me...

Thanks man....yes it does. I just got it! My script was more complicated and I had an error somewhere. Started over from scratch and bingo!! Been dicking with this for hours.

Should have spent more time with the script than looking for the answer!

Thanks again.

Share this post


Link to post
Share on other sites

>My script was more complicated and I had an error somewhere

You might find squint useful :)

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
Sign in to follow this  

×