Author Topic: Using isFunction() with Class::FunctionName / Checking if any indexed vars exist  (Read 891 times)

I've got a couple questions, so I'll just post them both in one thread.

First off, what's the proper way to check if something like Class::FunctionName is a function?
Using something such as echo(isfunction(Armor::OnCollision())); always returns 0, even when I know the function exists. I've also tried things such as:

echo(isfunction("Armor::OnCollision()"));
echo(isfunction(Armor.OnCollision()));
echo(isfunction(OnCollision()));

Yet nothing seems to work.



Second, how could I check if a variable exists under any index without using for()?
By this, I mean:

%this.someVariable[23918] = %someVariable;
%this.someVariable[102] = %someOtherVariable;

Would I be able to just use if(%this.somevariable) and it would evaluate to true if any variables named that under any index exist, or is that not possible without for()?


I've got a couple questions, so I'll just post them both in one thread.

First off, what's the proper way to check if something like Class::FunctionName is a function?
Using something such as echo(isfunction(Armor::OnCollision())); always returns 0, even when I know the function exists. I've also tried things such as:

echo(isfunction("Armor::OnCollision()"));
echo(isfunction(Armor.OnCollision()));
echo(isfunction(OnCollision()));

Yet nothing seems to work.

You would do:
Code: [Select]
isFunction(class,function);
Also, the answer to your second question is that you cannot.

Also, the answer to your second question is that you cannot.
Export object variables
open file
check for variables

Export object variables
open file
check for variables
Ok, there's no direct way to do it.

You would do:
Code: [Select]
isFunction(class,function);
Thanks.

Also, the answer to your second question is that you cannot.
Damn. I'll just use another method, then.

Damn. I'll just use another method, then.
Export object variables
open file through fileobjects
check for variables

Export object variables
open file
check for variables

That would be WAY less efficient than simply looping thru the vars, as long as you know the highest index.