[HOWTO] Using XVars
2 Attachment(s)
About XVars
XVars are public variables that can be accessed across plugins. Purpose: XVars should be used instead of CVars when the variables need to be private to the plugins. Creating: When creating XVars, they need to be global and public. Cross-Plugin: When accessing XVars from another plugin, you have to use specific natives. Duplication: Plugins can have the same public variables without compilation error or runtime error. Extra Notes: My test files can be used if you need any more understanding of how they work. |
Re: [HOWTO] Using XVars
Excellent Exolent! Previously I had very little knowledge about these but I did get them to work by looking at other plugins. This will make it easier to use this neat feature.
Any idea on speed relative to cvars or pcvars? Just curious. |
Re: [HOWTO] Using XVars
Quote:
But since they aren't the same as cvars (Xvars being security to plugins only) I think the choice between the 2 should be based on how they are needed. |
Re: [HOWTO] Using XVars
Very useful stuff, thanks for the info.
|
Re: [HOWTO] Using XVars
Quote:
So, you said that set_xvar_XXX works only in the "main" plugin ? Or is this the way to set an xvar from an outside plugin ? Also, i think that native xvar_exists is useless when get_xvar_id does actually the same + returns the index. |
Re: [HOWTO] Using XVars
Quote:
Quote:
However it is useless to use them in the main plugin since you have direct access to them. Quote:
|
Re: [HOWTO] Using XVars
Thnx Exolant i didnt even know about these :D
|
Re: [HOWTO] Using XVars
It appears that get_pcvar_num and get_xvar_num are executed with the same speed.
fake natives are slower. Plugins 1 : PHP Code:
PHP Code:
Dump : Code:
date: Fri Sep 24 19:18:23 2010 map: de_aztec |
Re: [HOWTO] Using XVars
Quote:
|
Re: [HOWTO] Using XVars
The speed is really trivial here and not worth to be mentioned. The choice should be more considering the user's preference or plugin design, not the speed. Just my opinion.
|
All times are GMT -4. The time now is 03:14. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.