You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
635 B
Lua
30 lines
635 B
Lua
|
|
local skynet = require 'skynet'
|
|
require "skynet.manager"
|
|
local word_crab_mod = require "word_crab_mod"
|
|
|
|
local word_crab_file = ...
|
|
|
|
local CMD = {}
|
|
|
|
function CMD.is_valid(input)
|
|
return word_crab_mod.is_valid(input)
|
|
end
|
|
|
|
skynet.start(function()
|
|
word_crab_mod.init(word_crab_file)
|
|
|
|
skynet.dispatch("lua", function(session, _, cmd, ...)
|
|
local f = CMD[cmd]
|
|
if not f then
|
|
assert(f, string.format("unknow command : %s", cmd))
|
|
end
|
|
if session ~= 0 then
|
|
skynet.retpack(f(...))
|
|
else
|
|
f(...)
|
|
end
|
|
end)
|
|
|
|
skynet.register("." .. SERVICE_NAME)
|
|
end) |