diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-05-06 11:58:21 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-05-06 16:41:50 +0200 |
commit | ad9f6744cb61550d3dbda15a17cb3ca66cb4724b (patch) | |
tree | d92571d64b8835800f934730444125e66d7d3254 /src | |
parent | 656e385f2ec2b5d855948569005ba14d2f244d8f (diff) | |
download | manaserv-ad9f6744cb61550d3dbda15a17cb3ca66cb4724b.tar.gz manaserv-ad9f6744cb61550d3dbda15a17cb3ca66cb4724b.tar.bz2 manaserv-ad9f6744cb61550d3dbda15a17cb3ca66cb4724b.tar.xz manaserv-ad9f6744cb61550d3dbda15a17cb3ca66cb4724b.zip |
Some small optimizations in Lua helper functions
Reviewed-by: Ben Longbons
Diffstat (limited to 'src')
-rw-r--r-- | src/scripting/luautil.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index ee4ac315..2395f211 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -202,9 +202,8 @@ template <typename T> void pushSTLContainer(lua_State *s, const std::list<T> &co for (int key = 1; key <= len; key++) { - push(s, key); push(s, *i); - lua_settable(s, table); + lua_rawseti(s, table, key); i++; } } @@ -218,9 +217,8 @@ template <typename T> void pushSTLContainer(lua_State *s, const std::vector<T> & for (int key = 0; key < len; key++) { - push(s, key+1); push(s, container.at(key)); - lua_settable(s, table); + lua_rawseti(s, table, key + 1); } } @@ -253,9 +251,8 @@ template <typename T> void pushSTLContainer(lua_State *s, const std::set<T> &con for (int key = 1; key <= len; key++) { - push(s, key); push(s, *i); - lua_settable(s, table); + lua_rawseti(s, table, key); i++; } } |