Some questions about Built-In Functions

0 favourites
  • 5 posts
  • The new built-in functions are excellent! I think this design is overall much more usable and tidy.

    First question: The old functions used to be able to check the Return Value of the last-run function with "Function.ReturnValue". Is this no longer possible with the new built-in functions? It always felt slightly kludgy to me (with the non-specific reference to a function just based off of it being last), but I did end up using it here and there. Is there a suggested method for doing something similar with the new functions?

    Second question: I'm finding that not all built-in functions I've created show up in the "Add 'Functions' action" window when I am trying to call them. Is there something that would cause one to not be shown on that list, or is this just a bug?

    It just occurred to me that maybe my questions are related: Are functions with return values not able to be called as an action, but can only be used in expressions?

    Tagged:

  • First question: The old functions used to be able to check the Return Value of the last-run function with "Function.ReturnValue". Is this no longer possible with the new built-in functions?

    No, functions called from expressions simply directly return the value from the expression.

    Second question: I'm finding that not all built-in functions I've created show up in the "Add 'Functions' action" window when I am trying to call them... Are functions with return values not able to be called as an action, but can only be used in expressions?

    Correct.

  • Thanks, Ashley!

    Maybe I'm the only one who had to refactor because of this change, but in case anyone else is in this situation, instead of calling the function for its functionality (which was more than just its return value) and then using Function.ReturnValue in subsequent conditions to harness its return value, I did a conditional check of the return value which also performs all the function's other actions at the same time. In one case where I needed that value multiple places, I saved it in a local variable. Probably all obvious, but thought I would lay out my solution.

  • It obviously makes sense to limit expression functions to functions with a return value, but is there any good reason to restrict action functions to functions without a return value ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have the same question as Magistross, where I think of return values as optional, maybe useful values, but that the important bit is the work done in the function.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)