M1ke_SK

[solved] check if param is piece of code

3 posts in this topic

I have params defined like this:

params ["_object", ["_code", {}]];

Question: how to check if there is some code?

if !(_code isEqualTo "") then
{
    _object spawn _code;
};

 

Share this post


Link to post
Share on other sites
if (!isNil "_code") then {
	// code
};

With this you check if the variable "_code" is defined.

Share this post


Link to post
Share on other sites
if (_code isEqualType {}) then
{
    _object spawn _code;
};

or you can force it

params ["_object", ["_code", {}, [{}]]];

 

1 person likes this

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