new auxiliary function `luaH_setstr'
This commit is contained in:
14
ltable.c
14
ltable.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: ltable.c,v 1.133 2003/04/28 13:31:46 roberto Exp roberto $
|
||||
** $Id: ltable.c,v 1.134 2003/04/28 19:26:16 roberto Exp roberto $
|
||||
** Lua tables (hash)
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -511,3 +511,15 @@ TObject *luaH_setnum (lua_State *L, Table *t, int key) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TObject *luaH_setstr (lua_State *L, Table *t, TString *key) {
|
||||
const TObject *p = luaH_getstr(t, key);
|
||||
if (p != &luaO_nilobject)
|
||||
return cast(TObject *, p);
|
||||
else {
|
||||
TObject k;
|
||||
setsvalue(&k, key);
|
||||
return newkey(L, t, &k);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user