new auxiliar function `luaH_setstr'

This commit is contained in:
Roberto Ierusalimschy
2000-06-05 17:15:33 -03:00
parent c542aac0b9
commit 292c953018
4 changed files with 16 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lbuiltin.c,v 1.111 2000/05/26 19:17:57 roberto Exp roberto $
** $Id: lbuiltin.c,v 1.112 2000/06/02 19:08:56 roberto Exp roberto $
** Built-in functions
** See Copyright Notice in lua.h
*/
@@ -68,12 +68,7 @@ static Number getsize (const Hash *h) {
static Number getnarg (lua_State *L, const Hash *a) {
TObject index;
const TObject *value;
/* value = table.n */
ttype(&index) = TAG_STRING;
tsvalue(&index) = luaS_new(L, "n");
value = luaH_get(L, a, &index);
const TObject *value = luaH_getstr(a, luaS_new(L, "n")); /* value = a.n */
return (ttype(value) == TAG_NUMBER) ? nvalue(value) : getsize(a);
}