aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-08-26 09:04:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-08-26 09:04:13 -0300
commitb1141427991dea7a96597f2aacdedf243b60decd (patch)
tree28a56414da88099502ae7d182b44e5201856c787 /ltable.c
parent4b2e71ddb674c3bb22f549743721155ddaeb9b5d (diff)
downloadlua-b1141427991dea7a96597f2aacdedf243b60decd.tar.gz
lua-b1141427991dea7a96597f2aacdedf243b60decd.tar.bz2
lua-b1141427991dea7a96597f2aacdedf243b60decd.zip
new auxiliary function `luaH_setstr'
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ltable.c b/ltable.c
index ed247d4e..c3bce93a 100644
--- a/ltable.c
+++ b/ltable.c
@@ -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
515TObject *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