self.c2_callFunction(name, params) or self["c2_callFunction"](name, params)?

0 favourites
  • 1 posts
  • In documention I find this:

     if (self.c2_callFunction) self.c2_callFunction("name", ["param1", "param2"]);
    

    So I create my own function:

     CallFunction(nameFunction = "", param = []) {
     if (self.c3_callFunction && nameFunction != "") {
     if (param.length === 0) {self.c3_callFunction(nameFunction);}
     else {self.c3_callFunction(nameFunction, param);}
     }
     }
    

    When I test it in Preview it's all ok. Also when I export the project without script minification.

    But if I want to unbly "minify script" in the export I have to use:

     CallFunction(nameFunction = "", param = []) {
     if (self["c3_callFunction"] && nameFunction != "") {
     if (param.length === 0) {self["c3_callFunction"](nameFunction);}
     else {self["c3_callFunction"](nameFunction, param);}
     }
     }
    

    My question is: what is the correct way between self.c3_callFunction("name", ["param1", "param2"]) and self["c3_callFunction"]("name", ["param1", "param2"])?

    I do not know if it's a bug or a lack in the documentation. I know for external api I must to use string syntax but I did not think it was for official API.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)