keygen.lua 280 B

12345678910111213
  1. local skynet = require "skynet"
  2. local c = require "snowflake.core"
  3. local prefix = nil
  4. local function gen()
  5. return prefix .. c.gen()
  6. end
  7. skynet.init(function()
  8. local snowflake = skynet.localname(".snowflake")
  9. prefix = skynet.call(snowflake, "lua", "prefix")
  10. end)
  11. return gen