1234567891011121314151617181920212223242526272829303132333435 |
- --[[
- Descripttion:
- version:
- Author: Neo,Huang
- Date: 2022-07-05 21:02:07
- LastEditors: Neo,Huang
- LastEditTime: 2022-07-06 10:06:29
- --]]
- local skynet = require "skynet"
- local sharetable = require "skynet.sharetable"
- local dir = skynet.getenv("config_path")
- local root = {}
- function root:getConfig(name)
- return sharetable.query(dir .. name .. ".lua")
- end
- function root:getOneConfig(name, value, key)
- local conf = self:getConfig(name)
- if not conf then
- return
- end
- key = key or "id"
- for k, v in ipairs(conf) do
- if v[key] == value then
- return v
- end
- end
- end
- return root
|