It is quite specific. I want to add a string to the array, like an array_push function, but the problem is that IDK how to do that. So simply, the config will look like this at first: Code: legoboy: [] And it will be changed after I add a string to the array: Code: legoboy: - string Thanks!
PHP: $array = $config->get("Lego", []); // [] is to make the default value an empty array$array[] = "string";$config->set("Lego", $array);
Do the same thing. Why do you think anything would be changed? BTW, alternative (but I don't like it personally because it won't work with cached getNested): PHP: $array =& $config->get("stuff");$array[] = "string";// done! No need to set again because Config::get() returns by reference and you stored variable by reference.
Code: PHP: $array = $this->ak->lol->get($player->getName(), []); // [] is to make the default value an empty array $array[] = $this->name; $this->ak->lol->set($player->getName(), $array); $this->ak->lol->save(); Error: Cannot use a scalar value as an array
use same as $config->setNested() and $config->getNested() instead of $config->get() and $config->set(); but remember it's cached to you must save it after session.