loader.lua 484 B

1234567891011121314151617181920212223
  1. local skynet = require "skynet"
  2. require "skynet.manager"
  3. local spawn = require "model.spawn"
  4. local skynet_call = skynet.call
  5. local module = {
  6. }
  7. local usercenter
  8. local function loader(uid)
  9. assert(uid)
  10. usercenter = usercenter or skynet.localname(".usercenter")
  11. local rets = skynet_call(usercenter, "lua", "load", uid)
  12. local t = spawn(true).loadfrom(rets)
  13. for _, elem in ipairs(module) do
  14. if elem.parse then
  15. elem.parse(t)
  16. end
  17. end
  18. return t
  19. end
  20. return loader