baseAdapt.lua 631 B

1234567891011121314151617181920212223242526272829303132333435
  1. --[[
  2. Descripttion:
  3. version:
  4. Author: Neo,Huang
  5. Date: 2022-07-05 21:02:07
  6. LastEditors: Neo,Huang
  7. LastEditTime: 2022-07-06 10:06:29
  8. --]]
  9. local skynet = require "skynet"
  10. local sharetable = require "skynet.sharetable"
  11. local dir = skynet.getenv("config_path")
  12. local root = {}
  13. function root:getConfig(name)
  14. return sharetable.query(dir .. name .. ".lua")
  15. end
  16. function root:getOneConfig(name, value, key)
  17. local conf = self:getConfig(name)
  18. if not conf then
  19. return
  20. end
  21. key = key or "id"
  22. for k, v in ipairs(conf) do
  23. if v[key] == value then
  24. return v
  25. end
  26. end
  27. end
  28. return root