lua-zset
lua-zset copied to clipboard
lua data structure same as redis sorted set
Uncheck mallocs are a bug no matter how good the rest of your code is!
大多数编程语言本身都提供***数组类型***,并且可以自定义排序。以lua为例 ```lua local list = { {name="a", count=1}, {name="b", count=2 } table.sort(list, function(a, b) if a.count ~= b.count then return a.count < b.count else return a.name < b.name end return...
# Why submit this PR? https://github.com/xjdrew/lua-zset/pull/16#issuecomment-2123816639 # 参数名使用 `options` 的原因 这个参数表示一组选项,而不是单独的一个选项。使用复数形式更加准确地描述了它的性质。 同时也可以提高代码的可读性,比如: ```lua for _, option in pairs(options) do end local option = options[xxx] ``` 没有使用 `opts`,因为 `options` 本身不是很长,没必要缩写。虽然很多库都使用 opts...