Static property in methodmap
Hello. I've been using static methods for my natives instead of normal functions, sort of like namespaces in other languages. I do know this is not how methodmaps are supposed to be used but it makes it much easier to distinguish what belongs to where, for example;
FooBar.Get(); instead of GetCurrentFooBar(); So my question: Is this possible? PHP Code:
PHP Code:
|
Re: Static property in methodmap
if it is "static", don't create the setter and return the value wanted on the get.
get() = { return 10; } EDIT: Or if u were looking the other way arround. int myVar = 0; FooBar.set(int value) = { myVar = value; } FooBar.get() = { return myVar; } no matter how many foobar you use they will refer to the same variable value. |
Re: Static property in methodmap
Okay so what i want is not FooBar.Get()/FooBar.Set(int value), i want to have multiple values i can retrieve/set with FooBar.Value = 1/FooBar.Value, just like ConVar.IntValue works. But after trying many different things it seems like it can't be done currently so i'll have to go with FooBar.Get/FooBar.Set for the time being.
|
Re: Static property in methodmap
I'm confuse of what your trying to do. I don't see the "static" mimic at all in what your trying to do.
posibility that I understand: #1 if you think you have to call FooBar.Get() or FooBar.Set() is because you do not understand methodmaps properties. You have to use FooBar.Value = 1 and FooBar.Value it just you have to declare inside your methodmap what will happen getter/setter. PHP Code:
If you want to save value per instance of object then you have to store it some where. Example of unlimited storage: PHP Code:
property int Value { public native set(); ... inside AskPluginLoad2 CreateNative("FooBar.Value.set", Native_SetFooBarValue); ... well that pretty much it Edit: none of the above has been really tested but the logic should be right and the examples prob work just don't be suprise if I mistype a var or w.e. |
All times are GMT -4. The time now is 14:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.