diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.133 2003/04/28 13:31:46 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.134 2003/04/28 19:26:16 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -511,3 +511,15 @@ TObject *luaH_setnum (lua_State *L, Table *t, int key) { | |||
511 | } | 511 | } |
512 | } | 512 | } |
513 | 513 | ||
514 | |||
515 | TObject *luaH_setstr (lua_State *L, Table *t, TString *key) { | ||
516 | const TObject *p = luaH_getstr(t, key); | ||
517 | if (p != &luaO_nilobject) | ||
518 | return cast(TObject *, p); | ||
519 | else { | ||
520 | TObject k; | ||
521 | setsvalue(&k, key); | ||
522 | return newkey(L, t, &k); | ||
523 | } | ||
524 | } | ||
525 | |||