From f6a902ebd5743d54321e1232dae40f15041be5a6 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 5 Dec 2018 15:16:37 +0800 Subject: =?UTF-8?q?*=E8=AE=BE=E7=BD=AEreference?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/common/je_lua.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/lua/common/je_lua.cpp') 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::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::iterator it = (*obj->dependencies).begin(); + for (; it != (*obj->dependencies).end(); ++it) { - map::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; } -- cgit v1.1-26-g67d0