
10-19-2007, 08:54 AM
|
|
Registered User
|
 |
Join Date: Sep 2004
Posts: 5,260
|
|
Quote:
Originally Posted by Novo
Ew @ variable-names as pure numbers. It's not compatible in most languages... It might work on Graal though. VERY bad habit to pick up... Better leave it where you found it. On the other hand... mud_[id] would be a better variable name. Otherwise, it's alright.
I would advise you to make a function to obtain the variables through a function ( So some wise-person doesn't just go and change them ). By pretending they are protected information, you would define a function such as this:
public function "getMudProp( mudID, prop ) return this.(@ mudID ).(@ propName );
This would prevent people from knowing where the data is... It would also provide an interface to work with. The benefits of this method is that when you change the internal workings of the item, the integrity of the server remains safe ( you modify the code in one place ). It also gives you some assurance you won't mistakenly change the data. It also permits you to debug it much more effectively later on... Or do some testing on it ( efficiency-wise ). It also gives you a concise abstract 'contract' with the DB-NPC: You know, just by the function name, what are you getting exactly.
EDIT:
I don't know the difference in speed between the both methods, but as stated above, do use a function.
|
Got ya, thanks.
I just thought that doing a loop serverside for each prop would cause some some problems |
|
|
|