lua-zset icon indicating copy to clipboard operation
lua-zset copied to clipboard

Move delete_handler to options

Open najoast opened this issue 9 months ago • 0 comments

Why submit this PR?

https://github.com/xjdrew/lua-zset/pull/16#issuecomment-2123816639

参数名使用 options 的原因

这个参数表示一组选项,而不是单独的一个选项。使用复数形式更加准确地描述了它的性质。 同时也可以提高代码的可读性,比如:

for _, option in pairs(options) do
end

local option = options[xxx]

没有使用 opts,因为 options 本身不是很长,没必要缩写。虽然很多库都使用 opts 作为选项参数名,但严格来说这是一种有损压缩,只有知道这个惯例的人才看的懂。

参数标注

对于 options 参数的说明,使用了 Emmylua 的标注。 好处是直观/易懂,且对于使用了 Emmylua 插件的同学来说,还可以智能提示。

najoast avatar May 22 '24 07:05 najoast