Structures in Pawn?
Does Pawn allow the creation of structures like C's struct?
e.g. struct OLDITEM { int iChecked; int iDisableCheck; BOOL bDisableEdit; int iOldIndex; char *szOldText; }; Currently I have half a dozen global arrays :S Stu |
Re: Structures in Pawn?
|
Re: Structures in Pawn?
Cheers :)
|
Re: Structures in Pawn?
On a side note, you can do this:
Code:
enum my_structOne problem here though is that my_float, my_handle, my_boolean and my_string are now defined globally, even though they are contained in an enumerator. Silly as it may seem, you cannot now use new Float:my_float etc in a procedure. Stu |
Re: Structures in Pawn?
Please note that these are in essence hacked enums. In my experience I've had way too many problems when trying to deal with them. For example, to properly access your variables with float tags within the enum, you must calculate a float offset to it. Or, at least that's what I've been told.
If in this instance it works for you, more power to ya ;). |
Re: Structures in Pawn?
I like them, I use them and I have never had any problems with them
|
Re: Structures in Pawn?
Quote:
Quote:
|
Re: Structures in Pawn?
That link is totally irrelevant, and yes you are wrong. There is nothing special needed to get floats, but using the enum struct stuff can sometimes require you to explicitly state the tag, otherwise you'll get some tag mismatches.
It's all preference. If you like the struct-like syntax, then use it. Most plugins are only maintained by one person, so syntax should only matter to that one person. The only thing I can think of off of the top of my head that could possibly break would be sizeof(), and I have no idea if it works or not, as I do not use that syntax. |
Re: Structures in Pawn?
That link is to the plugin that has the code I was referencing to. But anyways, thanks for correcting me; post deleted.
|
| All times are GMT -4. The time now is 21:24. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.