2025-07-18 06:09 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002467Spring engineLuapublic2011-06-21 21:22
Reporterabma 
Assigned Toabma 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.82.7+git 
Target Version83.0Fixed in Version 
Summary0002467: Remove remaining .n's
Descriptionand break more lua-code...

this will improve performance, cleanup & simplify coding. (at least i hope so...)
Additional Informationsee minutes:
http://springrts.com/phpbb/viewtopic.php?f=12&t=26199
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
has duplicate 0002456resolvedabma (master) morphing doesn't work 
+Relationships

-Notes

~0006731

abma (administrator)

Last edited: 2011-06-12 04:54

I'm unsure if this are all places where it needs to be removed:

rts/Lua $ grep -R \"n\" .
./LuaRules.cpp: HSTR_PUSH_NUMBER(L, "n", cmd.params.size());
./LuaUnitDefs.cpp: HSTR_PUSH_NUMBER(L, "n", count);
./LuaUnitDefs.cpp: HSTR_PUSH_NUMBER(L, "n", weaponCount);
./LuaUnitDefs.cpp: HSTR_PUSH_NUMBER(L, "n", soundCount);
./LuaSyncedRead.cpp:static const LuaHashString hs_n("n");
./LuaSyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", localModel->pieces.size());
./LuaSyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", op.childs.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", count);
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", v.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", unitDefMap.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", countMap.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", cmdDescCount);
./LuaUnsyncedRead.cpp: lua_pushstring(L, "n");
./LuaUnsyncedRead.cpp: lua_pushstring(L, "n");
./LuaUnsyncedRead.cpp: lua_pushstring(L, "n");
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", count);
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", v.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", unitDefMap.size());
./LuaUnsyncedRead.cpp: HSTR_PUSH_NUMBER(L, "n", countMap.size());
./LuaWeaponDefs.cpp: HSTR_PUSH_NUMBER(L, "n", soundCount);
./LuaOpenGL.cpp: else if ((key == "n") || (key == "normal")) {
./LuaUtils.cpp: if (dir == "n") { return 2; }
./LuaUtils.cpp: // params["n"] = numParams
./LuaUtils.cpp: HSTR_PUSH_NUMBER(L, "n", numParams);
./LuaVFS.cpp: lua_pushstring(L, "n");

~0006732

abma (administrator)

Last edited: 2011-06-12 05:17

major priority because this breaks many lua-scripts... for example the morphing-script is affected. these should be replaced before a release.

~0006735

FLOZi (reporter)

morphing script is easy to fix as the place .n is used is with an array, so # operator can be used instead.

Less nice is if there are any situations where maps are returned by the engine. Only way to count their elements without .n is to use a loop with pairs(), which can be slow, especially for large tables.

~0006799

abma (administrator)

thanks hoijui!

https://github.com/spring/spring/commit/1874b58f97d7cfab84decdb4ff5f36a810fa9336
+Notes

-Issue History
Date Modified Username Field Change
2011-06-12 04:47 abma New Issue
2011-06-12 04:47 abma Graphics Card => unknown
2011-06-12 04:48 abma Target Version => 0.83.0
2011-06-12 04:51 abma Relationship added has duplicate 0002456
2011-06-12 04:53 abma Note Added: 0006731
2011-06-12 04:54 abma Note Edited: 0006731
2011-06-12 05:16 abma Note Added: 0006732
2011-06-12 05:16 abma Severity tweak => major
2011-06-12 05:17 abma Note Edited: 0006732
2011-06-12 15:12 FLOZi Note Added: 0006735
2011-06-21 21:22 abma Note Added: 0006799
2011-06-21 21:22 abma Status new => resolved
2011-06-21 21:22 abma Resolution open => fixed
2011-06-21 21:22 abma Assigned To => abma
+Issue History