We propose a new framework for active learning of deterministic infinite-words automata. In our framework, the teacher answers standard membership and equivalence queries, and additionally it provides the loop index of the target automaton on wvω, which is the minimal number of letters of wvω past which the target automaton reaches the final cycle on wvω. We argue that in potential applications if one can answer Boolean part in membership (and equivalence) queries, one can compute the loop index as well.Our framework is an extension of Angluin's L⁎-algorithm with the crucial difference that the queries about the loop index depend on a particular automaton representing an ω-regular language. This allows us to bypass the NP-hardness coming from the minimisation problem for deterministic Büchi automata and provide a polynomial-time algorithm for learning deterministic weighted automata with ▪ value function. The algorithm can be easily adjusted for deterministic automata with ▪ value function and deterministic Büchi automata. Finally, deterministic parity automata, which recognize all ω-regular languages, can be considered as deterministic automata with ▪ value function and hence they can be learned in our framework.