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.
43 lines
808 B
Lua
43 lines
808 B
Lua
local skynet = require "skynet"
|
|
|
|
local cmd = { ... }
|
|
|
|
local function format_table(t)
|
|
local index = {}
|
|
for k in pairs(t) do
|
|
table.insert(index, k)
|
|
end
|
|
table.sort(index)
|
|
local result = {}
|
|
for _,v in ipairs(index) do
|
|
table.insert(result, string.format("%s:%s",v,tostring(t[v])))
|
|
end
|
|
return table.concat(result,"\t")
|
|
end
|
|
|
|
local function dump_line(key, value)
|
|
if type(value) == "table" then
|
|
print(key, format_table(value))
|
|
else
|
|
print(key,tostring(value))
|
|
end
|
|
end
|
|
|
|
local function dump_list(list)
|
|
local index = {}
|
|
for k in pairs(list) do
|
|
table.insert(index, k)
|
|
end
|
|
table.sort(index)
|
|
for _,v in ipairs(index) do
|
|
dump_line(v, list[v])
|
|
end
|
|
end
|
|
|
|
skynet.start(function()
|
|
local list = skynet.call(".launcher","lua", table.unpack(cmd))
|
|
if list then
|
|
dump_list(list)
|
|
end
|
|
skynet.exit()
|
|
end) |