aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:23 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-22 11:40:23 -0300
commitf388ee4a822b3d8027ed7c28aa21e9406e4a11eb (patch)
tree33053e6e31ac1dee0fe27ff7fdba64325a624fe1 /ltable.c
parent30ad4c75db38639f52fb1c8be1c5a3f5b58e776f (diff)
downloadlua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.tar.gz
lua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.tar.bz2
lua-f388ee4a822b3d8027ed7c28aa21e9406e4a11eb.zip
new way to handle errors
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ltable.c b/ltable.c
index c71179d1..0403f3c2 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.102 2002/03/18 18:18:35 roberto Exp roberto $ 2** $Id: ltable.c,v 1.103 2002/04/05 18:54:31 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*/
@@ -111,7 +111,7 @@ static int luaH_index (lua_State *L, Table *t, const TObject *key) {
111 else { 111 else {
112 const TObject *v = luaH_get(t, key); 112 const TObject *v = luaH_get(t, key);
113 if (v == &luaO_nilobject) 113 if (v == &luaO_nilobject)
114 luaD_error(L, "invalid key for `next'"); 114 luaD_runerror(L, "invalid key for `next'");
115 i = cast(int, (cast(const lu_byte *, v) - 115 i = cast(int, (cast(const lu_byte *, v) -
116 cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node)); 116 cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node));
117 return i + t->sizearray; /* hash elements are numbered after array ones */ 117 return i + t->sizearray; /* hash elements are numbered after array ones */
@@ -220,7 +220,7 @@ static void setnodevector (lua_State *L, Table *t, int lsize) {
220 int size; 220 int size;
221 if (lsize < MINHASHSIZE) lsize = MINHASHSIZE; 221 if (lsize < MINHASHSIZE) lsize = MINHASHSIZE;
222 else if (lsize > MAXBITS) 222 else if (lsize > MAXBITS)
223 luaD_error(L, "table overflow"); 223 luaD_runerror(L, "table overflow");
224 size = twoto(lsize); 224 size = twoto(lsize);
225 t->node = luaM_newvector(L, size, Node); 225 t->node = luaM_newvector(L, size, Node);
226 for (i=0; i<size; i++) { 226 for (i=0; i<size; i++) {
@@ -441,7 +441,7 @@ void luaH_set (lua_State *L, Table *t, const TObject *key, const TObject *val) {
441 settableval(p, val); 441 settableval(p, val);
442 } 442 }
443 else { 443 else {
444 if (ttype(key) == LUA_TNIL) luaD_error(L, "table index is nil"); 444 if (ttype(key) == LUA_TNIL) luaD_runerror(L, "table index is nil");
445 newkey(L, t, key, val); 445 newkey(L, t, key, val);
446 } 446 }
447 t->flags = 0; 447 t->flags = 0;