View Single Post
Author Message
pilger
Senior Member
Join Date: Sep 2010
Old 05-02-2015 , 22:38   Adt Arrays vs. KeyValues (few data)
Reply With Quote #1

Hey guys,


I'm coding a dynamic menu plugin that works somewhat like adminmenu.sp. It basically rely on a KeyValue file such as this:
Code:
"Adm"
{
    "vote"
    {
        "cmd1"
        {
            "cmd"        "votecmd1"
            "target"    "player"
            "question"    "pick a player"
        }
        "cmd2"
        {
            "cmd"        "votecmd2"
            "target"    "player"
            "question"    "pick a player"
        }
        "cmd3"
        {
            "cmd"        "votecmd2"
            "target"    "player"
            "question"    "pick a player"
        }
    }
    "action"
    {
        "mute"
        {
            "cmd"        "mute %s"
            "target"    "player"
            "question"    "pick a player"
        }
    }
}
This should create an admin menu with custom categories (e.g.: "Vote") and items (e.g.:"cmd1").

My question is about how should I store this data after parsing the kv file. The plugin would have to acess this info everytime someone opens up the menu. So should I stick to the kv structure and keep jumping back and forth to acess the data or should I send it all to an adt_array and drop the kv structure?

I guess this question is more theoretical than practical, since for such a small ammount of data, it wouldn't matter much which one I do. I'd like to know the best way to do it anyway. For the sake or learning and maybe applying on a future situation.
__________________
pilger is offline