route parsing in lua (rebased on dev 33e64aee6)