diff options
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.11 1998/01/13 18:06:27 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.12 1998/01/28 16:50:33 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 | */ |
@@ -162,7 +162,7 @@ TObject *luaH_get (Hash *t, TObject *ref) | |||
162 | { | 162 | { |
163 | int h = present(t, ref); | 163 | int h = present(t, ref); |
164 | if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h)); | 164 | if (ttype(ref(node(t, h))) != LUA_T_NIL) return val(node(t, h)); |
165 | else return NULL; | 165 | else return &luaO_nilobject; |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
@@ -214,3 +214,20 @@ Node *luaH_next (TObject *o, TObject *r) | |||
214 | return hashnext(t, i+1); | 214 | return hashnext(t, i+1); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | |||
218 | |||
219 | void luaH_setint (Hash *t, int ref, TObject *val) { | ||
220 | TObject index; | ||
221 | ttype(&index) = LUA_T_NUMBER; | ||
222 | nvalue(&index) = ref; | ||
223 | *(luaH_set(t, &index)) = *val; | ||
224 | } | ||
225 | |||
226 | |||
227 | TObject *luaH_getint (Hash *t, int ref) { | ||
228 | TObject index; | ||
229 | ttype(&index) = LUA_T_NUMBER; | ||
230 | nvalue(&index) = ref; | ||
231 | return luaH_get(t, &index); | ||
232 | } | ||
233 | |||