callback inconsistency question

So, say you want to set up your script functions like this...

function myScript::doThis()
//function stuff here

function myScript::doThat()
//function stuff here

Now, when adding these to a callback, for example...

callback.add(PlayerSpawn, "myScript.doThis();"); (Just using "PlayerSpawn" as an example).

or really any variation of that...

callback.add(PlayerSpawn, myScript.doThis);
or
callback.add(PlayerSpawn, "myScript.doThis");
etc..

This will work in some cases and not in others, and I'm curious if anyone knows why.

Sometimes, to get the callback to work I have to re-write the function to NOT include the colons.

function myScript::doThis()
//function stuff here

ends up forced to be

function myScriptdoThis()
//function stuff here


Not only that, some callbacks seem to require to be setup like this...

callback.add("PlayerSpawn", myScriptdoThis);

entering it like this...

callback.add(PlayerSpawn, myScript.doThis);
or
callback.add(PlayerSpawn, myScriptdoThis);
or
callback.add(PlayerSpawn, "myScript.doThis");
etc...

fails.

Just looking for some info on this.

Comments

Sign In or Register to comment.