1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

setNested within an array?

Discussion in 'Development' started by eDroid, Dec 28, 2016.

  1. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    how would i use setNested to set an array within another array?

    make it look something like (config.json):

    Code:
    "players": {
       "edroid": {
          "x": 0,
          "y": 128,
          "z": 0
       },
       "applqpak": {
          "x": 512,
          "y": 128,
          "z": 512
       },
       "ig": {
          "x": 128,
          "y": 128,
          "z": 128
       }
    }
    
     
    applqpak likes this.
  2. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    like how do i set the next player "beetree" to the array "players"?
     
    applqpak likes this.
  3. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    You could do:
    PHP:
    $players $config->get("players");
    $players['beetree'] = ["x" => 0"y" => 0"z" => 0];
    $config->set("players"$players);
     
    applqpak and eDroid like this.
  4. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    PHP:
    Config::setNested("players.beetree", [
      
    "x" => 0,
      
    "y" => 0,
      
    "z" => 0]);
     
    applqpak, eDroid and 0x15f like this.
  5. eDroid

    eDroid Witch

    Messages:
    59
    GitHub:
    edroiid
    thanks ill use this :)
     
    applqpak and 0x15f like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.