equal
deleted
inserted
replaced
175 t_insert(t, var); |
175 t_insert(t, var); |
176 end |
176 end |
177 return t; |
177 return t; |
178 end |
178 end |
179 |
179 |
|
180 function it.sorted_pairs(t, sort_func) |
|
181 local keys = it.to_array(it.keys(t)); |
|
182 table.sort(keys, sort_func); |
|
183 local i = 0; |
|
184 return function () |
|
185 i = i + 1; |
|
186 local key = keys[i]; |
|
187 if key ~= nil then |
|
188 return key, t[key]; |
|
189 end |
|
190 end; |
|
191 end |
|
192 |
180 -- Treat the return of an iterator as key,value pairs, |
193 -- Treat the return of an iterator as key,value pairs, |
181 -- and build a table |
194 -- and build a table |
182 function it.to_table(f, s, var) |
195 function it.to_table(f, s, var) |
183 local t, var2 = {}; |
196 local t, var2 = {}; |
184 while true do |
197 while true do |