diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-07-27 10:50:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-07-27 10:50:16 -0300 |
commit | 6d998055c80a0fe8d4698ba02becb1813203eee9 (patch) | |
tree | 7f39b89a0d383bc8a96708c5b1cc36a036099a2a /ltm.c | |
parent | 11769b203f052f7423575c1a66901cb9eb277206 (diff) | |
download | lua-6d998055c80a0fe8d4698ba02becb1813203eee9.tar.gz lua-6d998055c80a0fe8d4698ba02becb1813203eee9.tar.bz2 lua-6d998055c80a0fe8d4698ba02becb1813203eee9.zip |
no more reference 'memerrmsg' + new reference to "n"
(both can be retrieved by 'luaS_newliteral' without creating anything,
because they are fixed, but "n" deserves fast access while 'memerrmsg'
does not)
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.41 2017/05/13 12:57:20 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.42 2017/06/29 15:06:44 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -188,7 +188,7 @@ void luaT_adjustvarargs (lua_State *L, Proto *p, int actual) { | |||
188 | luaH_resize(L, vtab, actual, 1); | 188 | luaH_resize(L, vtab, actual, 1); |
189 | for (i = 0; i < actual; i++) /* put extra arguments into vararg table */ | 189 | for (i = 0; i < actual; i++) /* put extra arguments into vararg table */ |
190 | setobj2n(L, &vtab->array[i], s2v(L->top - actual + i - 1)); | 190 | setobj2n(L, &vtab->array[i], s2v(L->top - actual + i - 1)); |
191 | setsvalue(L, &nname, luaS_newliteral(L, "n")); /* get field 'n' */ | 191 | setsvalue(L, &nname, G(L)->nfield); /* get field 'n' */ |
192 | setivalue(luaH_set(L, vtab, &nname), actual); /* store counter there */ | 192 | setivalue(luaH_set(L, vtab, &nname), actual); /* store counter there */ |
193 | L->top -= actual; /* remove extra elements from the stack */ | 193 | L->top -= actual; /* remove extra elements from the stack */ |
194 | sethvalue2s(L, L->top - 1, vtab); /* move table to new top */ | 194 | sethvalue2s(L, L->top - 1, vtab); /* move table to new top */ |
@@ -202,7 +202,7 @@ void luaT_getvarargs (lua_State *L, TValue *t, StkId where, int wanted) { | |||
202 | int i; | 202 | int i; |
203 | Table *h = hvalue(t); | 203 | Table *h = hvalue(t); |
204 | if (wanted < 0) { /* get all? */ | 204 | if (wanted < 0) { /* get all? */ |
205 | const TValue *ns = luaH_getstr(h, luaS_newliteral(L, "n")); | 205 | const TValue *ns = luaH_getstr(h, G(L)->nfield); |
206 | int n = (ttisinteger(ns)) ? ivalue(ns) : 0; | 206 | int n = (ttisinteger(ns)) ? ivalue(ns) : 0; |
207 | wanted = n; | 207 | wanted = n; |
208 | checkstackp(L, n, where); | 208 | checkstackp(L, n, where); |