Code: Select all
testObj := {
key: "a",
function: script(x) {
SendInput("l")
}
}
Code: Select all
script(x) {
SendInput("l")
}
testObj := {
key: "a",
function: script
}
I've gone over the docs for objects and functions and can't seem to find why defining an object's properties like this doesn't work. It's definitely the curly braces that are the issue, if you instead do function: (x)=> SendInput("l") it works fine, but obviously that isn't suitable for more complex functions that aren't as simple as a single line.
Thoughts? Crossing my fingers this is a real mystery and not something obvious I missed, but it seems to be straightforwardly weird.