Hi Folks,
As of
PR #934, SourceMod 1.10 has support for enum structs. This is some long-overdue syntactic sugar that makes SourcePawn feel more like a real language. Enum Structs are internally implemented as arrays, but the syntax is a lot nicer than before and we've fixed a lot of the corner cases and rough edges around using them. You can also have enum struct methods now.
You can read more about enum structs either in the
Transitional Syntax Docs, or in the
commit message.
If you're too impatient to read that, I'll just copy and paste the sample code from the doc:
PHP Code:
enum struct Rectangle {
int x;
int y;
int width;
int height;
int Area() {
return this.width * this.height;
}
}
void DoStuff(const Rectangle r) {
PrintToServer("%d, %d, %d, %d", r.x, r.y, r.width, r.height);
}
__________________