File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -693,6 +693,21 @@ function m.sortCallbackOfIndex(arr)
693
693
end
694
694
end
695
695
696
+ --- @param datas any[]
697
+ --- @param scores integer[]
698
+ --- @return SortByScoreCallback
699
+ function m .sortCallbackOfScore (datas , scores )
700
+ local map = {}
701
+ for i = 1 , # datas do
702
+ local data = datas [i ]
703
+ local score = scores [i ]
704
+ map [data ] = score
705
+ end
706
+ return function (v )
707
+ return map [v ]
708
+ end
709
+ end
710
+
696
711
--- 裁剪字符串
697
712
--- @param str string
698
713
--- @param mode ? ' "left"' | ' "right"'
@@ -851,12 +866,13 @@ function m.multiTable(count, default)
851
866
end })
852
867
end
853
868
for _ = 3 , count do
869
+ local tt = current
854
870
current = setmetatable ({}, { __index = function (t , k )
855
871
if k == nil then
856
872
return nil
857
873
end
858
- t [k ] = current
859
- return current
874
+ t [k ] = tt
875
+ return tt
860
876
end })
861
877
end
862
878
return current
You can’t perform that action at this time.
0 commit comments