"." (dot) uses
#1

Hello,

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

any help will be appreciated, thanks
Reply
#2

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 !
Reply
#3

oh, Thanks very much!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)