From 4594ba652293e776ccba2184c16502a346f4147a Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sat, 30 Nov 2013 12:11:07 -0500 Subject: Optimize table creation --- src/script/lua_api/l_rollback.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/script/lua_api/l_rollback.cpp') diff --git a/src/script/lua_api/l_rollback.cpp b/src/script/lua_api/l_rollback.cpp index e7185b00b..b3685c8d1 100644 --- a/src/script/lua_api/l_rollback.cpp +++ b/src/script/lua_api/l_rollback.cpp @@ -50,7 +50,6 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L) lua_createtable(L, actions.size(), 0); for (unsigned int i = 1; iter != actions.end(); ++iter, ++i) { - lua_pushnumber(L, i); // Push index lua_createtable(L, 0, 5); // Make a table with enough space pre-allocated lua_pushstring(L, iter->actor.c_str()); @@ -68,7 +67,7 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L) push_RollbackNode(L, iter->n_new); lua_setfield(L, -2, "newnode"); - lua_settable(L, -3); // Add action table to main table + lua_rawseti(L, -2, i); // Add action table to main table } return 1; -- cgit v1.2.3