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

Returning int, expected bool!

Discussion in 'Development' started by M4nt0s, Dec 19, 2019.

  1. M4nt0s

    M4nt0s Spider Jockey

    Messages:
    31
    GitHub:
    M4nt0s
    Hey i am trying to return a config value when running an command.
    I konw The error is in the 2nd line from the bottom but i dont have any idea how to change that.On the end of the function is return true; so without trying to return the value it is working.

    Code:
    if(strtolower($command->getName()) === "sj"){
        if($args[0] == "create"){
    
            $config = (new Config($this->getDataFolder() . "arenas.yml", Config::YAML, array(
                "$args[1]" => ["world", "minp", "maxp"],
                )))->getAll();
                $config["$args[1]"]["world"] = "test";
                return $config["$args[1]"]["world"];
                $p->sendMessage("$args[1]");
    
        }
     
  2. Gianluxx

    Gianluxx Slime

    Messages:
    94
    GitHub:
    Gianluxx
    Do you know what return is?
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    returning the value sets the output of the function to be the returned value. it does not display the value anywhere. Please learn at least the basics before requesting help here. Your issue isn't even API related.
     
    HimbeersaftLP likes 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.