Use of createTable on containers

This commit is contained in:
Henrique Santiago 2013-12-22 17:36:43 -02:00
parent df3546b073
commit 1e17919a26
2 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@
int push_luavalue(const Outfit& outfit) int push_luavalue(const Outfit& outfit)
{ {
g_lua.newTable(); g_lua.createTable(0, 8);
g_lua.pushInteger(outfit.getId()); g_lua.pushInteger(outfit.getId());
g_lua.setField("type"); g_lua.setField("type");
g_lua.pushInteger(outfit.getAuxId()); g_lua.pushInteger(outfit.getAuxId());
@ -80,7 +80,7 @@ bool luavalue_cast(int index, Outfit& outfit)
int push_luavalue(const Position& pos) int push_luavalue(const Position& pos)
{ {
if(pos.isValid()) { if(pos.isValid()) {
g_lua.newTable(); g_lua.createTable(0, 3);
g_lua.pushInteger(pos.x); g_lua.pushInteger(pos.x);
g_lua.setField("x"); g_lua.setField("x");
g_lua.pushInteger(pos.y); g_lua.pushInteger(pos.y);
@ -108,7 +108,7 @@ bool luavalue_cast(int index, Position& pos)
int push_luavalue(const MarketData& data) int push_luavalue(const MarketData& data)
{ {
g_lua.newTable(); g_lua.createTable(0, 6);
g_lua.pushInteger(data.category); g_lua.pushInteger(data.category);
g_lua.setField("category"); g_lua.setField("category");
g_lua.pushString(data.name); g_lua.pushString(data.name);

View File

@ -287,7 +287,7 @@ luavalue_cast(int index, std::function<Ret(Args...)>& func) {
template<typename T> template<typename T>
int push_luavalue(const std::list<T>& list) { int push_luavalue(const std::list<T>& list) {
g_lua.newTable(); g_lua.createTable(list.size(), 0);
int i = 1; int i = 1;
for(const T& v : list) { for(const T& v : list) {
push_internal_luavalue(v); push_internal_luavalue(v);
@ -315,7 +315,7 @@ bool luavalue_cast(int index, std::list<T>& list)
template<typename T> template<typename T>
int push_luavalue(const std::vector<T>& vec) { int push_luavalue(const std::vector<T>& vec) {
g_lua.newTable(); g_lua.createTable(vec.size(), 0);
int i = 1; int i = 1;
for(const T& v : vec) { for(const T& v : vec) {
push_internal_luavalue(v); push_internal_luavalue(v);
@ -343,7 +343,7 @@ bool luavalue_cast(int index, std::vector<T>& vec)
template<typename T> template<typename T>
int push_luavalue(const std::deque<T>& vec) { int push_luavalue(const std::deque<T>& vec) {
g_lua.newTable(); g_lua.createTable(vec.size(), 0);
int i = 1; int i = 1;
for(const T& v : vec) { for(const T& v : vec) {
push_internal_luavalue(v); push_internal_luavalue(v);