refactor(frontends/lua): add lua_migrate_fn, and make copy_values modular

copy_values is not a big if-then-else anymore.
Before this change, whenever we added a new kind of userdata, we would have to update copy_values.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
refactor(frontends/lua): add lua_migrate_fn, and make copy_values modular