Skip to content

Commit

Permalink
error report on sharedata newindex
Browse files Browse the repository at this point in the history
  • Loading branch information
t0350 committed Apr 24, 2017
1 parent 89d7719 commit 3b6b312
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lualib/sharedata/corelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,18 @@ local function getcobj(self)
return obj
end

function meta:__newindex(key, value)
error ("Error newindex, the key [" .. genkey(self) .. "]")
end

function meta:__index(key)
local obj = getcobj(self)
local v = index(obj, key)
if type(v) == "userdata" then
local children = self.__cache
if children == nil then
children = {}
self.__cache = children
rawset(self, "__cache", children)
end
local r = children[key]
if r then
Expand Down

0 comments on commit 3b6b312

Please sign in to comment.