How to have an object copy the mouse's x and y location?

In other words, how could I, in a 2d game, have an object ‘stick’ to the cursor?

I tried applying the object’s location to the mouse’s location like this:

own.localPosition(mouse.position[0], mouse.position[1], 0)

but it didn’t work correctly…

You can find it in the examples, is called modal mouse!
The mouse move is a event.