From ad9f6744cb61550d3dbda15a17cb3ca66cb4724b Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 6 May 2012 11:58:21 +0200 Subject: Some small optimizations in Lua helper functions Reviewed-by: Ben Longbons --- src/scripting/luautil.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/scripting') diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index ee4ac31..2395f21 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -202,9 +202,8 @@ template void pushSTLContainer(lua_State *s, const std::list &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 void pushSTLContainer(lua_State *s, const std::vector & 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 void pushSTLContainer(lua_State *s, const std::set &con for (int key = 1; key <= len; key++) { - push(s, key); push(s, *i); - lua_settable(s, table); + lua_rawseti(s, table, key); i++; } } -- cgit