diff options
author | chai <chaifix@163.com> | 2018-12-05 15:16:37 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-05 15:16:37 +0800 |
commit | f6a902ebd5743d54321e1232dae40f15041be5a6 (patch) | |
tree | b04fc4377453e9ed94030629b0f34054dde28097 /src/lua/common/je_lua.cpp | |
parent | c78bd640228c0b6b9f7c294793c4f2f58b637c67 (diff) |
*设置reference
Diffstat (limited to 'src/lua/common/je_lua.cpp')
-rw-r--r-- | src/lua/common/je_lua.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/lua/common/je_lua.cpp b/src/lua/common/je_lua.cpp index 21d3fa6..1c1f5aa 100644 --- a/src/lua/common/je_lua.cpp +++ b/src/lua/common/je_lua.cpp @@ -32,8 +32,7 @@ namespace JinEngine LuaObject* luax_newinstance(lua_State* L, LuaObject* src) { - bool another = L != src->state; - if(another) + if(L != src->state) { // Copy dependencies. map<uint, SharedBase*>::iterator it = (*src->dependencies).begin(); @@ -56,14 +55,11 @@ namespace JinEngine luax_settable(L, -3); luax_pop(L, 1); // Pop objects table. // Set dependencies. - if (another) + map<uint, SharedBase*>::iterator it = (*obj->dependencies).begin(); + for (; it != (*obj->dependencies).end(); ++it) { - map<uint, SharedBase*>::iterator it = (*obj->dependencies).begin(); - for (; it != (*obj->dependencies).end(); ++it) - { - SharedBase* dep = it->second; - luax_addreference(L, shr, dep); - } + SharedBase* dep = it->second; + luax_addreference(L, shr, dep); } return obj; } |