What is it @?
#1

i saw alot codes example

new @var...

what that @ does mean? if someone can give me some examples and informations, thanks!
Reply
#2

@var? Never heard of it..
Reply
#3

That is just example, here is the new one...

pawn Код:
new @var = (5);
printf("%d", @var);
What @ does when is prefix on variables?
Reply
#4

EDIT: Global variable.
Read below..
Reply
#5

Yes i know, but this do something and i don't know what, this is from y_tuple (***** code)

pawn Код:
stock
    _@TUPLE_gRet[29],
    _@Tuple:_@TUPLE_gTag;
Reply
#6

From pawn-lang.pdf
Quote:

Global “simple” variables (no arrays) may be declared “public” in two ways:
⋄ declare the variable using the keyword public instead of new;
⋄ start the variable name with the “@” symbol.
Public variables behave like global variables, with the addition that the host program can also read and write public variables. A (normal) global variable can only be accessed by the functions in your script —the host program is unaware of them. As such, a host program may require that you declare a variable with a specific name as “public” for special purposes —such as the most recent error number, or the general program state.

However I dont really know why you would need public variables for samp.
Reply
#7

@Mauzen - Nice, now i know that declare public variable
Hmm if someone know little more about this it would be good to put some examples
Reply
#8

Id also like to know people use it. Afaik it wont have any effect, global variables are global and so "public", you cant access filterscript variables even if they are public, and the "host program" wont ever access any public variables of the script. So theres no reason at all why you should make variables public for samp scripts. Maybe the guys who did that just used it as some special symbol in variable naming.
BTW the code snippet from ****** doesnt use public variables, the @ isnt the first symbol of the name, so it is just treated as part of the variable/tag name. The @ just has a meaning when it is the very first symbol.
Reply
#9

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
maybe ******' y_amx library may be of some significance...
Highly likely that it is, I have no other explanation...

@Mauzen - Anyway, to access other scripts (FS) there are PVars, i know ****** don't love them
Reply
#10

It might be so that variables inside of includes don't interfere with gamemodes/filterscripts.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)