Found when using the example code in cursor.md, it does not work as expected. The callback is never called.
From the current cursor.md:
-- not work
cursor.listen("#cursor", cursor.DRAG_START, function(message_id, message)
-- prevent dragging of blue aliens
if message.group == hash("blue") then
return true -- return true to block the event
end
end)
It does work as expected if we use the full url instead of the url string "#cursor":
-- works
cursor.listen(msg.url("#cursor"), cursor.DRAG_START, function(message_id, message)
-- prevent dragging of blue aliens
if message.group == hash("blue") then
return true -- return true to block the event
end
end)
I was going to submit a PR for cursor.md with updated example code, but then I saw that it says cursor.listen() should take either a url or string, so I'm not sure if the doc needs fixed or cursor.lua needs fixed.
Found when using the example code in cursor.md, it does not work as expected. The callback is never called.
From the current cursor.md:
It does work as expected if we use the full url instead of the url string "#cursor":
The URL is also how it is in the example controller.script
I was going to submit a PR for cursor.md with updated example code, but then I saw that it says cursor.listen() should take either a url or string, so I'm not sure if the doc needs fixed or cursor.lua needs fixed.