aboutsummaryrefslogtreecommitdiff
path: root/ltable.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltable.c')
-rw-r--r--ltable.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/ltable.c b/ltable.c
index 486b09a8..b9e42c18 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.87 2001/10/25 19:14:14 roberto Exp $ 2** $Id: ltable.c,v 1.88 2001/11/16 16:29:51 roberto Exp $
3** Lua tables (hash) 3** Lua tables (hash)
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -23,7 +23,6 @@
23 23
24 24
25 25
26#define LUA_PRIVATE
27#include "lua.h" 26#include "lua.h"
28 27
29#include "ldo.h" 28#include "ldo.h"
@@ -101,7 +100,7 @@ int luaH_index (lua_State *L, Table *t, const TObject *key) {
101 else { 100 else {
102 const TObject *v = luaH_get(t, key); 101 const TObject *v = luaH_get(t, key);
103 if (v == &luaO_nilobject) 102 if (v == &luaO_nilobject)
104 luaD_error(L, l_s("invalid key for `next'")); 103 luaD_error(L, "invalid key for `next'");
105 i = cast(int, (cast(const lu_byte *, v) - 104 i = cast(int, (cast(const lu_byte *, v) -
106 cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node)); 105 cast(const lu_byte *, val(node(t, 0)))) / sizeof(Node));
107 return i + t->sizearray; /* hash elements are numbered after array ones */ 106 return i + t->sizearray; /* hash elements are numbered after array ones */
@@ -193,7 +192,7 @@ static void numuse (const Table *t, int *narray, int *nhash) {
193static void setarrayvector (lua_State *L, Table *t, int size) { 192static void setarrayvector (lua_State *L, Table *t, int size) {
194 int i; 193 int i;
195 if (size > twoto(MAXBITS)) 194 if (size > twoto(MAXBITS))
196 luaD_error(L, l_s("table overflow")); 195 luaD_error(L, "table overflow");
197 luaM_reallocvector(L, t->array, t->sizearray, size, TObject); 196 luaM_reallocvector(L, t->array, t->sizearray, size, TObject);
198 for (i=t->sizearray; i<size; i++) 197 for (i=t->sizearray; i<size; i++)
199 setnilvalue(&t->array[i]); 198 setnilvalue(&t->array[i]);
@@ -206,7 +205,7 @@ static void setnodevector (lua_State *L, Table *t, int lsize) {
206 int size; 205 int size;
207 if (lsize < MINHASHSIZE) lsize = MINHASHSIZE; 206 if (lsize < MINHASHSIZE) lsize = MINHASHSIZE;
208 else if (lsize > MAXBITS) 207 else if (lsize > MAXBITS)
209 luaD_error(L, l_s("table overflow")); 208 luaD_error(L, "table overflow");
210 size = twoto(lsize); 209 size = twoto(lsize);
211 t->node = luaM_newvector(L, size, Node); 210 t->node = luaM_newvector(L, size, Node);
212 for (i=0; i<size; i++) { 211 for (i=0; i<size; i++) {
@@ -417,7 +416,7 @@ void luaH_set (lua_State *L, Table *t, const TObject *key, const TObject *val) {
417 settableval(p, val); 416 settableval(p, val);
418 } 417 }
419 else { 418 else {
420 if (ttype(key) == LUA_TNIL) luaD_error(L, l_s("table index is nil")); 419 if (ttype(key) == LUA_TNIL) luaD_error(L, "table index is nil");
421 newkey(L, t, key, val); 420 newkey(L, t, key, val);
422 } 421 }
423} 422}