bindExternalFunctionGeneral method

void bindExternalFunctionGeneral(
  1. String funcName,
  2. ExternalFunction func, {
  3. bool lookaheadSafe = true,
})
Most general form of function binding that returns an object and takes an array of object parameters. The only way to bind a function with more than 3 arguments. EXTERNAL ink function name to bind to. The C# function to bind. The ink engine often evaluates further than you might expect beyond the current line just in case it sees glue that will cause the two lines to become one. In this case it's possible that a function can appear to be called twice instead of just once, and earlier than you expect. If it's safe for your function to be called in this way (since the result and side effect of the function will not change), then you can pass 'true'. Usually, you want to pass 'false', especially if you want some action to be performed in game code when this function is called.

Implementation

void bindExternalFunctionGeneral(String funcName, ExternalFunction func,
    {bool lookaheadSafe = true}) {
  ifAsyncWeCant('bind an external function');
  assert(!_externals.containsKey(funcName),
      "Function '" + funcName + "' has already been bound.");
  _externals[funcName] = ExternalFunctionDef()..function = func;
}