在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
lines = { luaH_set = 10, luaH_get = 24, luaH_present = 48, } function pairsByKeys (t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end f=function(a,b) if a > b then return true end end for name, line in pairsByKeys(lines,f) do print(name, line) end |
请发表评论