13.04.2015, 15:31
@Emmet_ : static globals are useful. But only in libraries.
OT : Nice tut. I was aware of it, though never told it to correct someone - I'm maybe guilty or maybe not, not that I answered much helping threads - IMO that was useless since, as someone (sorry to not remember the name) said above, the lambda samp user won't learn from this. Some of them will read, but none of them will learn. Their only point being here is to get their scripting problems solved by someone else.
By the way we're talking about functions, I read somewhere that you could "forward" public functions using the "static" keyword. This way, the public function will be static : if another function with the same name exists in a gamemode where your library is included, it won't create compiling errors.
OT : Nice tut. I was aware of it, though never told it to correct someone - I'm maybe guilty or maybe not, not that I answered much helping threads - IMO that was useless since, as someone (sorry to not remember the name) said above, the lambda samp user won't learn from this. Some of them will read, but none of them will learn. Their only point being here is to get their scripting problems solved by someone else.
By the way we're talking about functions, I read somewhere that you could "forward" public functions using the "static" keyword. This way, the public function will be static : if another function with the same name exists in a gamemode where your library is included, it won't create compiling errors.
PHP Code:
// in mylib.inc
static myPublic();
public myPublic()
{
printf("Called from library");
}
// in gm
#include <mylib>
forward myPublic();
public myPublic()
{
printf("Called from gamemode");
return 1;
}