mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix #257
This commit is contained in:
@@ -30,12 +30,14 @@ function sharemap.writer(typename, obj)
|
|||||||
local sp = loadsp()
|
local sp = loadsp()
|
||||||
obj = obj or {}
|
obj = obj or {}
|
||||||
local stmobj = stm.new(sp:encode(typename,obj))
|
local stmobj = stm.new(sp:encode(typename,obj))
|
||||||
obj.__typename = typename
|
local ret = {
|
||||||
obj.__obj = stmobj
|
__typename = typename,
|
||||||
obj.__data = obj
|
__obj = stmobj,
|
||||||
obj.commit = sharemap.commit
|
__data = obj,
|
||||||
obj.copy = sharemap.copy
|
commit = sharemap.commit,
|
||||||
return setmetatable(obj, { __index = obj.__data, __newindex = obj.__data })
|
copy = sharemap.copy,
|
||||||
|
}
|
||||||
|
return setmetatable(ret, { __index = obj, __newindex = obj })
|
||||||
end
|
end
|
||||||
|
|
||||||
local function decode(msg, sz, self)
|
local function decode(msg, sz, self)
|
||||||
@@ -63,7 +65,7 @@ function sharemap.reader(typename, stmcpy)
|
|||||||
__data = data,
|
__data = data,
|
||||||
update = sharemap.update,
|
update = sharemap.update,
|
||||||
}
|
}
|
||||||
return setmetatable(obj, { __index = obj.__data, __newindex = error })
|
return setmetatable(obj, { __index = data, __newindex = error })
|
||||||
end
|
end
|
||||||
|
|
||||||
return sharemap
|
return sharemap
|
||||||
|
|||||||
Reference in New Issue
Block a user