How can I get datas from an array in a config? How can I create an array in a config? How can I set datas in an array in a config?
Config::get($yourArray) doesn't make any sense. First, that won't work because it wants a string. And, why would you get an array out of a config you already have($yourArray)??
OOOPS I of course meant Config::set("array", $yourArray); Config::get("array"); Sorry for the confusion
No. To create an array in a config: PHP: $config = (new Config($plugin->getDataFolder() . "config.yml", Config::YAML, array("array_example" => ["one", "two", "three"],)))->getAll(); To return the array: PHP: return $config["array_example"]; To return a value in the array: PHP: return $config["array_example"]["one"]; To set a value in the array: PHP: $config["array_example"]["one"] = 1;
PHP: $config = new Config(/*Whatever*/);// Set an array$config->set("arrayName", $array);// Get an array$array = $config->get("arrayName"); If you want manually create an array: Code: thisIsAnArray: - "first parameter" - "second parameter" I saw some people using tabs in an unidimensional array Code: array: - "first parameter" - "second parameter" And, no, never do it, it's a bad practice.
I can, in QWERTY keyboards, under the number "1", there is a key... What happen if you press it in a yaml file? Another thing is what happen when you enconde/decode it.
Hey, you are smart. Like all LBSG members, no? It's like a law: You can comply it, but you can ignore it, and, if you read my last post... ↓↓↓↓ ↑↑↑↑ If you cannot see it, please, visit this website. http://www.glasses.com/ ... also, I read that website before your likes-searcher post
I don't know what your problem is, to be honest. Please learn about YAML files and come back later. Also, it is not just a bad practice. As mentioned before, learn about YAML files.
He apparently knows YAML. Calm, he did pointed out that tabs can not be used in yaml, even twice but you plainly ignored him @AndrewBit You showed unnecessary reaction
He actually didn't. "Never do it, it's a bad practice" does not mean that you cannot do it. "I can, in QWERTY keyboards, under the number "1", there is a key... What happen if you press it in a yaml file? " Same here. I don't see him telling that you cannot use them.
And you cannot expect that I understand that you don't have a sense of humour. Back on the topic, I really don't understand what's wrong with tabs. If tabs are used in the whole file, it has no difference from a single space (YAML accepts single-space indents too) The only problem is that YAML developers are worried that they aren't used in the whole file Maybe this would give more reference to the argument between tabs and spaces: https://github.com/PocketMine/PocketMine-MP/pull/2110