diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.88 2001/11/16 16:29:51 roberto Exp $ | 2 | ** $Id: ltable.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -258,11 +258,12 @@ static void rehash (lua_State *L, Table *t) { | |||
258 | 258 | ||
259 | Table *luaH_new (lua_State *L, int narray, int lnhash) { | 259 | Table *luaH_new (lua_State *L, int narray, int lnhash) { |
260 | Table *t = luaM_new(L, Table); | 260 | Table *t = luaM_new(L, Table); |
261 | t->htag = TagDefault; | 261 | t->eventtable = hvalue(defaultet(L)); |
262 | t->next = G(L)->roottable; | 262 | t->next = G(L)->roottable; |
263 | G(L)->roottable = t; | 263 | G(L)->roottable = t; |
264 | t->mark = t; | 264 | t->mark = t; |
265 | t->weakmode = 0; | 265 | t->weakmode = 0; |
266 | t->flags = ~0; | ||
266 | /* temporary values (kept only if some malloc fails) */ | 267 | /* temporary values (kept only if some malloc fails) */ |
267 | t->array = NULL; | 268 | t->array = NULL; |
268 | t->sizearray = 0; | 269 | t->sizearray = 0; |
@@ -419,19 +420,7 @@ void luaH_set (lua_State *L, Table *t, const TObject *key, const TObject *val) { | |||
419 | if (ttype(key) == LUA_TNIL) luaD_error(L, "table index is nil"); | 420 | if (ttype(key) == LUA_TNIL) luaD_error(L, "table index is nil"); |
420 | newkey(L, t, key, val); | 421 | newkey(L, t, key, val); |
421 | } | 422 | } |
422 | } | 423 | t->flags = 0; |
423 | |||
424 | |||
425 | void luaH_setstr (lua_State *L, Table *t, TString *key, const TObject *val) { | ||
426 | const TObject *p = luaH_getstr(t, key); | ||
427 | if (p != &luaO_nilobject) { | ||
428 | settableval(p, val); | ||
429 | } | ||
430 | else { | ||
431 | TObject k; | ||
432 | setsvalue(&k, key); | ||
433 | newkey(L, t, &k, val); | ||
434 | } | ||
435 | } | 424 | } |
436 | 425 | ||
437 | 426 | ||