A new PAWN version - 4.0.4548
#7

Quote:
Originally Posted by Kalcor
View Post
SA-MP scripters have so much code bound to enum style structs. I doubt this would be an easy transition. I do like what it has been replaced with. There is a much cleaner way of defining structs now and accessing member variables.
Quote:

- Previous versions of pawn used enumerations and tags to simulate a light-weight variant of structures. This has been replaced by a more direct way to declare "symbolic indices" in arrays. An array can now be declared as:

new rect[.left, .top, .right, .bottom]

The array can then only be indexed with one of the declared symbolic fields, such as in:

rect[.bottom] = rect[.top] + 15

Since the only valid index is a symbolic field, the brackets may be omitted, giving the shorter equivalent:

rect.bottom = rect.top + 15

Symbolic indices may specify a tag for the field, and may also indicate a (pseudo-)array. Please see the "Language Guide" for details.

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~

- To make the new way to specify symbolic indices more practical, the "#define" preprocessor directive now also supports definitions that are delimited with square brackets. This means that definitions do not have to fit on a single line. An example of such a declaration:

#define PRODUCT[
.code,
.description{20},
Float: .price
]

Later, this definition can be used to declare an array, for example:
new product[PRODUCT]

Wouldn't that mean:

pawn Code:
enum ePlayerInfo
{
    Skin,
    Money
}
new PlayerInfo[MAX_PLAYERS][ePlayerInfo];
to

pawn Code:
#define PLAYERINFO[
    .Skin,
    .Money
]
new PlayerInfo[MAX_PLAYERS][PLAYERINFO];
Not much to edit if that's correct.
Reply


Messages In This Thread
A new PAWN version - 4.0.4548 - by Steve M. - 04.08.2011, 13:43
Re: A new PAWN version - 4.0.4548 - by WoodPecker - 04.08.2011, 13:47
Re: A new PAWN version - 4.0.4548 - by Calgon - 04.08.2011, 13:52
Re: A new PAWN version - 4.0.4548 - by Karlip - 04.08.2011, 14:18
Re: A new PAWN version - 4.0.4548 - by Kalcor - 04.08.2011, 15:05
Re: A new PAWN version - 4.0.4548 - by Calgon - 04.08.2011, 15:16
Re: A new PAWN version - 4.0.4548 - by Finn - 04.08.2011, 18:13
Re: A new PAWN version - 4.0.4548 - by Steve M. - 04.08.2011, 18:21
Re: A new PAWN version - 4.0.4548 - by Donya - 04.08.2011, 18:32
Re: A new PAWN version - 4.0.4548 - by Amit_B - 04.08.2011, 21:54

Forum Jump:


Users browsing this thread: 4 Guest(s)