summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-05-06 11:58:21 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-05-06 16:41:50 +0200
commitad9f6744cb61550d3dbda15a17cb3ca66cb4724b (patch)
treed92571d64b8835800f934730444125e66d7d3254
parent656e385f2ec2b5d855948569005ba14d2f244d8f (diff)
downloadmanaserv-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
-rw-r--r--src/scripting/luautil.h9
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++;
}
}