-
I have this code to update some things whenever the mouse location changes mp.observe_property("mouse-pos", "native",
function(name, value)
if value then
preview(value.x,value.y)
end
end) where preview refers to another function i want called whenever the mouse changes position. But I can't seem to disable this after I start it, according to searches I should be able to use something like mp.unobserve_property("mouse-pos") But it doesn't seem to be doing anything. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Please read the docs before trying random things. It takes a function reference - not a property name. So you should make it a normal local function (and not a lambda function) and then observe or unobserve that function name. like this: local function my_func(...)
...
end
mp.observe_property("some-property", "some-type", my_func)
mp.unobserve_property(my_func) |
Beta Was this translation helpful? Give feedback.
Please read the docs before trying random things.
It takes a function reference - not a property name. So you should make it a normal local function (and not a lambda function) and then observe or unobserve that function name.
like this: