ubx.lua: major refactoring, method support for key types