Skip to content

Commit a633b01

Browse files
authored
Merge pull request #1647 from Gowa2017/master
Update luaecs and skynet API
2 parents 6030fd1 + eb9eaab commit a633b01

File tree

2 files changed

+40
-61
lines changed

2 files changed

+40
-61
lines changed

meta/3rd/luaecs/library/ecs.lua

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ end
7979
function meta:select(pat)
8080
end
8181

82-
---Sync C memory data to the iter which contains the index id and component id by then pattern the entity meet.
83-
---Read component with in, and write component to C which with out.
84-
---This is a additional featur, we use select most times.
85-
---@param pat string #pattern whcih the iter specified entity meet.
86-
---@param iter ITER # {pool index, cid}
87-
---@see ECSWorld#_sync
88-
function meta:sync(pat, iter)
89-
end
90-
9182
---Sync all then component of the eneity represent by a iter
9283
---@param iter number|ITER #ITER or entity id
9384
---@return table
@@ -121,15 +112,6 @@ end
121112
function meta:update(tagname)
122113
end
123114

124-
---Select a singleton component. Singleton component only hava a instance, the pool index is 1.
125-
---`pattern` and `iter` must gived or not the same time.
126-
---@param name string Component name
127-
---@param pattern? string #key [opt inout] , opt is : or ?, inout is in, out, update, like t:in, b:out, id?update. **Used to select other component into the Singleton Component.
128-
---@param iter? table # when give, is update and return it.
129-
---@return table {1, cid, component...}
130-
function meta:singleton(name, pattern, iter)
131-
end
132-
133115
local M = {
134116
_MAXTYPE = 255,
135117
_METHODS = meta,
@@ -342,22 +324,15 @@ end
342324
function meta:_object(ref, cv, index)
343325
end
344326

345-
---C API
346-
---Sync data from iter to C memory.
347-
---@param iter userdata #iter function
348-
---@param t ITER
349-
---@return table
350-
---@see ECSWorld#sync
351-
function meta:_sync(iter, t)
352-
end
353-
354327
---@param pattern string
355328
---@param iter ITER
356329
function meta:_read(pattern, iter)
357330
end
358331

359-
---No use
360-
function meta:submit(...) end
332+
---C API
333+
---Commit an mod of a group iter with out or new
334+
---@param iter ITER
335+
function meta:submit(iter) end
361336

362337
---@see ECSWorld:#first
363338
function meta:_first(...) end

meta/3rd/skynet/library/skynet.lua

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@
1313
---|+'"trace"'
1414
---@alias SERVICEADDR '".servicename"' | '":0000000C"' | integer
1515
---@alias MESSAGEHANDLER fun(session:integer, source:integer, cmd:string, ...)
16-
local skynet = {
17-
-- read skynet.h
18-
PTYPE_TEXT = 0,
19-
PTYPE_RESPONSE = 1,
20-
PTYPE_MULTICAST = 2,
21-
PTYPE_CLIENT = 3,
22-
PTYPE_SYSTEM = 4,
23-
PTYPE_HARBOR = 5,
24-
PTYPE_SOCKET = 6,
25-
PTYPE_ERROR = 7,
26-
PTYPE_QUEUE = 8, -- used in deprecated mqueue, use skynet.queue instead
27-
PTYPE_DEBUG = 9,
28-
PTYPE_LUA = 10,
29-
PTYPE_SNAX = 11,
30-
PTYPE_TRACE = 12, -- use for debug trace
31-
PNAME_TEXT = "text",
32-
PNAME_RESPONSE = "response",
33-
PNAME_MULTICAST = "muliticast",
34-
PNAME_CLIENT = "client",
35-
PNAME_SYSTEM = "system",
36-
PNAME_HARBOR = "harbor",
37-
PNAME_SOCKET = "socket",
38-
PNAME_ERROR = "error",
39-
PNAME_QUEUE = "queue",
40-
PNAME_DEBUG = "debug",
41-
PNAME_LUA = "lua",
42-
PNAME_SNAX = "snax",
43-
PNAME_TRACE = "trace",
16+
local skynet = {
17+
-- read skynet.h
18+
PTYPE_TEXT = 0,
19+
PTYPE_RESPONSE = 1,
20+
PTYPE_MULTICAST = 2,
21+
PTYPE_CLIENT = 3,
22+
PTYPE_SYSTEM = 4,
23+
PTYPE_HARBOR = 5,
24+
PTYPE_SOCKET = 6,
25+
PTYPE_ERROR = 7,
26+
PTYPE_QUEUE = 8, -- used in deprecated mqueue, use skynet.queue instead
27+
PTYPE_DEBUG = 9,
28+
PTYPE_LUA = 10,
29+
PTYPE_SNAX = 11,
30+
PTYPE_TRACE = 12, -- use for debug trace
31+
PNAME_TEXT = "text",
32+
PNAME_RESPONSE = "response",
33+
PNAME_MULTICAST = "muliticast",
34+
PNAME_CLIENT = "client",
35+
PNAME_SYSTEM = "system",
36+
PNAME_HARBOR = "harbor",
37+
PNAME_SOCKET = "socket",
38+
PNAME_ERROR = "error",
39+
PNAME_QUEUE = "queue",
40+
PNAME_DEBUG = "debug",
41+
PNAME_LUA = "lua",
42+
PNAME_SNAX = "snax",
43+
PNAME_TRACE = "trace",
4444

4545
}
4646

@@ -103,8 +103,8 @@ end
103103
---* 你需要挂起一个请求,等将来时机满足,再回应它。而回应的时候已经在别的 coroutine 中了。
104104
---针对这种情况,你可以调用 skynet.response(skynet.pack) 获得一个闭包,以后调用这个闭包即可把回应消息发回。
105105
---这里的参数 skynet.pack 是可选的,你可以传入其它打包函数,默认即是 skynet.pack 。
106-
---@param msg lightuserdata
107-
---@param sz integer
106+
---@param msg lightuserdata|string
107+
---@param sz? integer
108108
function skynet.ret(msg, sz)
109109
end
110110

@@ -227,8 +227,8 @@ end
227227
---* 挂起期间,状态可能会变更,造成重入
228228
---@param addr SERVICEADDR @目标服务地址
229229
---@param typename string @类型名
230-
---@param msg lightuserdata
231-
---@param sz number
230+
---@param msg lightuserdata|string
231+
---@param sz? number
232232
function skynet.rawcall(addr, typename, msg, sz)
233233
end
234234

@@ -240,15 +240,18 @@ request.__call = request.add
240240
---@param obj table # {addr, typename, ...}
241241
function request:add(obj)
242242
end
243+
243244
function request:close()
244245
end
246+
245247
function request:select(timeout)
246248
end
247249

248250
---@param obj? table
249251
---@return request
250252
function skynet.request(obj)
251253
end
254+
252255
---* 返回一个唯一的会话ID
253256
---@return number
254257
function skynet.genid()
@@ -546,4 +549,5 @@ end
546549
function skynet.info_func(fun)
547550

548551
end
552+
549553
return skynet

0 commit comments

Comments
 (0)