diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-15 15:57:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-15 15:57:44 -0300 |
commit | b7a0503c1d72603b8f7e480f2abecbc05348cb69 (patch) | |
tree | bfac646fea320f73abec2ee57a0c96a704452884 /ltable.c | |
parent | 1c328a191a8b86b7ad601cb9a935f1da5373fdf7 (diff) | |
download | lua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.tar.gz lua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.tar.bz2 lua-b7a0503c1d72603b8f7e480f2abecbc05348cb69.zip |
new format for error messages
Diffstat (limited to 'ltable.c')
-rw-r--r-- | ltable.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.106 2002/05/08 17:34:00 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.107 2002/05/13 13:38:59 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 | */ |
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "lua.h" | 26 | #include "lua.h" |
27 | 27 | ||
28 | #include "ldebug.h" | ||
28 | #include "ldo.h" | 29 | #include "ldo.h" |
29 | #include "lmem.h" | 30 | #include "lmem.h" |
30 | #include "lobject.h" | 31 | #include "lobject.h" |
@@ -111,7 +112,7 @@ static int luaH_index (lua_State *L, Table *t, const TObject *key) { | |||
111 | else { | 112 | else { |
112 | const TObject *v = luaH_get(t, key); | 113 | const TObject *v = luaH_get(t, key); |
113 | if (v == &luaO_nilobject) | 114 | if (v == &luaO_nilobject) |
114 | luaD_runerror(L, "invalid key for `next'"); | 115 | luaG_runerror(L, "invalid key for `next'"); |
115 | i = cast(int, (cast(const lu_byte *, v) - | 116 | i = cast(int, (cast(const lu_byte *, v) - |
116 | cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node)); | 117 | cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node)); |
117 | return i + t->sizearray; /* hash elements are numbered after array ones */ | 118 | return i + t->sizearray; /* hash elements are numbered after array ones */ |
@@ -214,7 +215,7 @@ static void setnodevector (lua_State *L, Table *t, int lsize) { | |||
214 | int i; | 215 | int i; |
215 | int size = twoto(lsize); | 216 | int size = twoto(lsize); |
216 | if (lsize > MAXBITS) | 217 | if (lsize > MAXBITS) |
217 | luaD_runerror(L, "table overflow"); | 218 | luaG_runerror(L, "table overflow"); |
218 | if (lsize == 0) { /* no elements to hash part? */ | 219 | if (lsize == 0) { /* no elements to hash part? */ |
219 | t->node = G(L)->dummynode; /* use common `dummynode' */ | 220 | t->node = G(L)->dummynode; /* use common `dummynode' */ |
220 | lua_assert(ttype(key(t->node)) == LUA_TNIL); /* assert invariants: */ | 221 | lua_assert(ttype(key(t->node)) == LUA_TNIL); /* assert invariants: */ |
@@ -449,7 +450,7 @@ void luaH_set (lua_State *L, Table *t, const TObject *key, const TObject *val) { | |||
449 | settableval(p, val); | 450 | settableval(p, val); |
450 | } | 451 | } |
451 | else { | 452 | else { |
452 | if (ttype(key) == LUA_TNIL) luaD_runerror(L, "table index is nil"); | 453 | if (ttype(key) == LUA_TNIL) luaG_runerror(L, "table index is nil"); |
453 | newkey(L, t, key, val); | 454 | newkey(L, t, key, val); |
454 | } | 455 | } |
455 | t->flags = 0; | 456 | t->flags = 0; |