diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-09-26 11:40:56 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-09-26 11:40:56 -0400 |
commit | 0d5f5f6380a7087f86c5fcd7c761ea5a175c3f17 (patch) | |
tree | 1781a22d2a7d8f77bf6e4cf5a2a1c91e7f9f001d /indra/newview/lldndbutton.h | |
parent | f48dd40db06d15e5da7fd3a98324e284a0640b2d (diff) |
DRTVWR-589: Collect int table keys in vector<int>, not set<int>.
Given that we at least have a possibility of determining the length of a Lua
table in advance, we might be able to populate a vector of keys with a single
initial allocation. Even if Lua reports the length incorrectly,
vector::push_back() is one of the bread-and-butter operations of the library,
optimized to the extent possible. Inserting elements into a set seems more
likely to incur allocations.
Of course, we must then sort() the vector to determine its largest key value.
Also document the requirement that we use a Lua runtime compiled for C++, that
is, compiled to raise errors by C++ exceptions rather than by longjmp(). We
rely on temporary stack objects being properly destroyed even if errors are
raised.
Conventionally, with lua_tomumble(L, index), 'index' refers to the stack index
of the Lua object being converted to C++. For a Lua table, talk about table
keys rather than table indexes to avoid confusing the maintainer.
Diffstat (limited to 'indra/newview/lldndbutton.h')
0 files changed, 0 insertions, 0 deletions