Is there a reason why we canʻt call mapped functions and pass parameters directly / router function

0 favourites
  • 3 posts
From the Asset Store
Voice call plugin based on webrtc protocol for construct 3
  • I think many people have said they prefer c2 functions over c3 and for me personally that is because we cannot simply call a function from a string without it being first pushed through a router function.

    Router functions are nice for certain patterns, but sometimes you simply need a good old function pointer.

    Why canʻt we call a mapped function by string directly, and choose to send it parameters?

    The current implementation is unnecessarily rigid and overly complicated, and makes it impossible to have a 100% flexible function call.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm using scripting when I need to call a function by name, it's much easier than setting up mapped functions.

  • I like that way, but not if it needs to be used regularly in events through a single js block...

    Lets just say its fine, but if you have performance woes, avoid jsblocks inside loops at all costs. As a replacement for a custom action, for example, in a foreach obj loop, calling the function via js is like 300x slower than by event, as far as the raw overhead goes.

    On the other hand, if you have a function call from within a jsblock that is doing the iterating, that will be faster.

    TLDR is don't loop outside of a js block.

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