mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
feat: add sharetable queryall (#1536)
Co-authored-by: Jason <jie-email@jie-trancender.org>
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
local skynet = require "skynet"
|
||||
local sharetable = require "skynet.sharetable"
|
||||
|
||||
local function queryall_test()
|
||||
sharetable.loadtable("test_one", {["message"] = "hello one", x = 1, 1})
|
||||
sharetable.loadtable("test_two", {["message"] = "hello two", x = 2, 2})
|
||||
local list = sharetable.queryall({"test_one", "test_two"})
|
||||
for filename, tbl in pairs(list) do
|
||||
for k, v in pairs(tbl) do
|
||||
print(filename, k, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
skynet.start(function()
|
||||
-- You can also use sharetable.loadfile / sharetable.loadstring
|
||||
sharetable.loadtable ("test", { x=1,y={ 'hello world' },['hello world'] = true })
|
||||
@@ -13,4 +24,6 @@ skynet.start(function()
|
||||
for k,v in pairs(t) do
|
||||
print(k,v)
|
||||
end
|
||||
|
||||
queryall_test()
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user