Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[New API] Create a temporary Config instance

Comments in 'Plugin Development' started by EvolSoft, May 10, 2015.

  1. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Hi :)
    I want to create a temporary Config instance without saving the file. Is it possible?
    I tried with:
    PHP:
    $cfg = new Config(nullConfig::YAML);
    $data = array("temp" => "test");
    $cfg->setAll($data);
    //Then
    echo $cfg->get("temp");
    This code works but it generates a File not found error
    Is there a better way to do this without get the error?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What about "/dev/null" (for Linux only)?

    And what about "php://tmp"?

    Actually, why do you even need it? Why not just use an array?
    EvolSoft likes this.
  3. EvolSoft
    Offline

    EvolSoft Notable Member Plugin Developer

    Joined:
    Sep 10, 2014
    Posts:
    821
    Plugins:
    15
    Minecraft User:
    Flavius12
    Yes it's better. I wanted to do this only to keep PocketMine Config class functions
    iksaku likes this.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Create your own class...
    iksaku and LDX like this.

Share This Page

Advertisement