Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot call functions off of a map #123

Closed
huynhphuchuy opened this issue Oct 21, 2023 · 2 comments
Closed

Cannot call functions off of a map #123

huynhphuchuy opened this issue Oct 21, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@huynhphuchuy
Copy link

huynhphuchuy commented Oct 21, 2023

I got an error with Map function while List function is working well

z = [
  "Ghost",
  57.3,
  function (x1) {
    print("X * X")
    return x * x
  }
]

zz = {
    "name": "Ghost",
    "value": 57.3,
    "handler": function(zzz) { 
        print("zzz * zzz")
        return zzz * zzz
    }
}

print(z[2](5))
print(zz.handler(6))
@huynhphuchuy huynhphuchuy changed the title [Bug] Map function hanlder [Issue] Map function handler Oct 21, 2023
@kaidesu kaidesu changed the title [Issue] Map function handler Cannot call functions off of a map Oct 21, 2023
@kaidesu kaidesu added the bug Something isn't working label Oct 21, 2023
@ryangjchandler
Copy link

I don't think maps support the method call syntax right now. The only way to do this would be using the index syntax, so zz["handler"](6).

@kaidesu
Copy link
Member

kaidesu commented Oct 27, 2023

In this case it's evaluated as a "method" which was missing a case for the map object 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants