本网站正在建设中(~ ̄▽ ̄)~

  • 你好~!欢迎来到中文歌声合成个人收集站-VCPedia.cn!
  • 若发现页面信息有误投稿至本站,请联系管理员。

Module:SortArgs

VCPedia.cn ——关于中文歌声合成的一切。
跳到导航 跳到搜索
Template-info.svg 模块文档  [创建] [刷新]
  1. local module = {}
  2. function module.sortedArgs(args, sort_ref, ref_sep)
  3. local args_dump = {}
  4. sort_ref = mw.text.split(sort_ref, ref_sep, false)
  5. if #sort_ref then table.remove(sort_ref, #sort_ref) end
  6. for idx, key in ipairs(sort_ref) do
  7. args_dump[idx] = { key, args[key] or args[tonumber(key)] }
  8. end
  9. local index = 0
  10. return function ()
  11. index = index + 1
  12. if not args_dump[index] then
  13. index = 0
  14. return nil
  15. end
  16. return unpack(args_dump[index])
  17. end
  18. end
  19. return module