Jump to content
Sign in to follow this  
mind

Strange behaviour with buttonSetAction

Recommended Posts

Hi all,

 

I encountered rather strange and very dangerous bug.

 

Following code will execute, but will ignore structure elements like IF blocks. Resulting in both lines written.

_action = '
   if (true) then {
      hint "This line MUST print"
   } else {
      hint "This line MUST NOT print"
   }
';
_button buttonSetAction _action;

Pressing this button will result in printing both lines with no errors, it is if like there were no IF block or it`s evaluation skipped.

 

However following code will execute as expected

_action = 'if (true) then {hint "This line MUST print"} else {hint "This line MUST NOT print"}';
_button buttonSetAction _action;

It looks like newlines and tabs, causing this strange behaviour.

 

P.S.

Other workaround for buttonSetAction is using calling global function.

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  

×