'luaH_get' functions return tag of the result

Undoing previous commit. Returning TValue increases code size without
any visible gains. Returning the tag is a little simpler than returning
a special code (HOK/HNOTFOUND) and the tag is useful by itself in
some cases.
This commit is contained in:
Roberto Ierusalimschy
2024-03-21 11:23:21 -03:00
parent ce6f5502c9
commit 0593256707
10 changed files with 139 additions and 133 deletions

View File

@@ -132,8 +132,9 @@ static void dumpString (DumpState *D, TString *ts) {
if (ts == NULL)
dumpSize(D, 0);
else {
TValue idx = luaH_getstr(D->h, ts);
if (!isemptyV(idx)) { /* string already saved? */
TValue idx;
int tag = luaH_getstr(D->h, ts, &idx);
if (!tagisempty(tag)) { /* string already saved? */
dumpSize(D, 1); /* reuse a saved string */
dumpSize(D, cast_sizet(ivalue(&idx))); /* index of saved string */
}