Replies: 2 comments
-
Unfortunately, there's not really a syntax in Lua for what you're trying to do. Lua doesn't have 'bound methods' like in, say, Python. When you write If you want something shorter than writing an anonymous function wrapper each time, you can write a function to generate those wrappers for you: -- 'M' for 'method'. You can name this whatever you want.
function M(object, name)
local func = object[name]
return function(...)
return func(object, ...)
end
end
myFunction(M(hotkeyhandler, 'disable')) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Marking as closed because @Rhys-T is correct and wrapping the method call is the correct choice here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i like to do some stuff with a method of an object - in this case
hs.hotkey:disable()
where is my mistake so i can not call it with
fn()
?Beta Was this translation helpful? Give feedback.
All reactions