Giter Site home page Giter Site logo

Comments (2)

bs-mwoerner avatar bs-mwoerner commented on August 23, 2024

According to the documentation for bind():
When this method is chained with other similar methods, the order in which the argument list is modified is read from right to left.

So the order in this example actually needs to be callable = callable.bind([]).bind(1).

However, it looks like there may be an issue with the error messages: unbind() creates a callable that ignores a number of parameters passed in any future calls to call(). So in this example:

callable.unbind(arguments.size()).call(arguments[0], arguments[1])

the method is not called with arguments[0] and arguments[1] (1, []), but with the previously bound parameters ([], 1), which produces the message about an argument mismatch. However, the error message seems to refer to the (ignored) first argument to call, which actually is an int, so the resulting message is the nonsensical "cannot convert int to int".

In a more simplified version:

func foo(int_param: int) -> void:
    pass

[...]

Callable(foo).bind(1).unbind(1).call('text')
Callable(foo).bind('text').unbind(1).call(1)

The first call will work, while the second will result in "Cannot convert argument 1 from int to int".

from godot.

BastiaanGrutters avatar BastiaanGrutters commented on August 23, 2024

Thanks for your explanation, makes it a bit easier to work around this.

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.