register_handler() and multiple instances of a plugin

I’ve got a question about luup.register_handler().

Say I have two instances of the same device, and in the implementation for that device there is a register_handler().

When the lr_handlername HTTP request comes in, which device’s Lua context is used? Is it random and indeterminate? Is it random but the same each time? Is it possible for the HTTP request to ask for the Luup context of one device or the other to be used?

I’m pretty sure the handler is overwritten by the device whose code runs last. So if device A’s code runs first and assigns the fooA() function to the handler, and device B’s code runs last and assigns the fooB() function to the handler, when the HTTP request comes in the fooB() function will be executed.