[Question] Checking if function exists?
#1

How would you check if a function is already defined in the script?
Reply
#2

It would need to be a public function.

pawn Код:
if(funcidx("OnFilterScriptInit") > -1)
{
    // exist
}
else
{
    // doesn't exist
}
Reply
#3

I know about that function, but would it apply for stocks?
Reply
#4

Just turn it into a public, no biggie.
Reply
#5

That's the thing, I can't do that.

Here's the issue:

There is a stock in the YSI library which is defined as 'bernstein' (hashing algorithm).
I need to use that function for an include I am working on, however the YSI library is very common.

If I would add the function to the include, people who use the YSI library will get an error saying that the function is already defined.

However if I don't put it in, assuming people already have that function defined people who don't use the YSI library will get an error saying the function is not defined.

I could rename it, but I believe people wouldn't want the same function to be defined twice in their gamemode assuming they would use the include.

Any suggestions?
Reply
#6

pawn Код:
#if defined
?
Reply
#7

I have tried to use that, however it does some weird things...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)