Should the second value be ignored or added to the first one?
Basically...
Option 1:
Code:
1. Deathrun IP: 127.0.0.1:27016
2. Classic IP: 127.0.0.1:27018
Option 2:
Code:
1. Deathrun IP: 127.0.0.1:27016|IP: 127.0.0.1:27017
2. Classic IP: 127.0.0.1:27018
If the first option applies:
Create a cellarray to store all the categories, if one already exists just ignore the other. This would require a loop to check which is pretty bad.
Another option would be to use a trie with the category as the key and just checking if the key exists. Remember to clear it when you've generated the menu.
If the second option applies:
You would have to buffer all information until you are ready to push it out into the menu.
I would again use a trie to store the data using the category as a key. That way you could easily edit it until you are ready to push the menu. The problem being you would have to have something to remember all the keys as you need them later to generate the menu. In this case set up a cellarray to remember the trie keys.
There might be better options. These are dynamic and therefor scalable. If you only have a few menu options you would most likely be better off by using static arrays. It all depends on the situation. Is this plugin private or something you plan on releasing? Do you want it to be idiot proof or does it require some basic knowledge to set up correctly?
__________________