SA-MP Forums Archive
"." (dot) uses - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: "." (dot) uses (/showthread.php?tid=404926)



"." (dot) uses - Youice - 04.01.2013

Hello,

I want to know the uses and the benefits of the "." (dot) in scripting?

any help will be appreciated, thanks


Re: "." (dot) uses - IstuntmanI - 04.01.2013

It is used in functions with many optional parameters, when you want to directly skip to a parameter, the ones before it stays with the default value.

Let's say we have this function
pawn Код:
native MyFunction( playerid, Interior = 0, World = 1, Cash = 1000, Fat = 10 );
You want to set only cash to this playerid, so you can do directly in a callback:
pawn Код:
MyFunction( playerid, .Cash = 421 );
So the function will look internal like:
pawn Код:
MyFunction( playerid, 0, 1, 421, 10 );
After . you have to use parameter's exact name to work !


Re: "." (dot) uses - Youice - 04.01.2013

oh, Thanks very much!!!