Question about an array

Discussion in 'Development' started by TestDevelopment, May 28, 2021.

  1. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    How is it possible to add fast a large amount of items to an array.

    Like forlooping a area of blocks an then add it to an array foreach block.

    Possible? If yes please tell me :)
     
  2. minijaham

    minijaham Zombie Pigman

    Messages:
    514
    GitHub:
    minijaham
    Technically anything is possible in PMMP.

    + I'm not really sure what you mean. Could you please explain in more detail, with proper English grammar please?
     
  3. ComorDev

    ComorDev Spider

    Messages:
    11
    GitHub:
    comordev
    The array can be quickly filled with a loop, but at the expense of saying "Like forlooping a area of blocks an then add it to an array foreach block." could you tell us in more detail?
     
  4. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    i want to add like 50000 entrys in a array in like a second or so
     
  5. ErikX

    ErikX Baby Zombie

    Messages:
    116
    GitHub:
    ErikPDev
    You can use array push to push data into an array.
    PHP:
    array_push($array$values );
    Example:
    PHP:
    $array = [];
    foreach(
    $this->plugin->getServer()->getOnlinePlayers() as $player){
        
    array_push($array$player);
    }
     
  6. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    this wont work for me -.-
     
  7. ErikX

    ErikX Baby Zombie

    Messages:
    116
    GitHub:
    ErikPDev
    What data are you trying to store? What have you tried? Give examples xd
     
  8. TestDevelopment

    TestDevelopment Spider Jockey

    Messages:
    41
    GitHub:
    non
    i just stored a bool and a string
     

Share This Page

  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.