aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-11 17:08:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-05-11 17:08:20 -0300
commit705eae9fe49956ec8247cc8737b908e84d25bb9f (patch)
treea7b2ea9cba341ac3d4e18714f3b28a603dff1d2b /lapi.c
parent6eb1399a1c662f45ab5511a5e7d35fdb967ec076 (diff)
downloadlua-705eae9fe49956ec8247cc8737b908e84d25bb9f.tar.gz
lua-705eae9fe49956ec8247cc8737b908e84d25bb9f.tar.bz2
lua-705eae9fe49956ec8247cc8737b908e84d25bb9f.zip
there is no need for a size for Cblocks
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/lapi.c b/lapi.c
index e71eb4ae..45fa7f27 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.42 1999/03/26 13:14:00 roberto Exp roberto $ 2** $Id: lapi.c,v 1.43 1999/05/11 14:19:32 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -167,15 +167,12 @@ lua_Object lua_gettable (void)
167} 167}
168 168
169 169
170lua_Object lua_rawgettable (void) 170lua_Object lua_rawgettable (void) {
171{
172 checkCparams(2); 171 checkCparams(2);
173 if (ttype(L->stack.top-2) != LUA_T_ARRAY) 172 if (ttype(L->stack.top-2) != LUA_T_ARRAY)
174 lua_error("indexed expression not a table in rawgettable"); 173 lua_error("indexed expression not a table in rawgettable");
175 else { 174 *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1);
176 *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1); 175 --L->stack.top;
177 --L->stack.top;
178 }
179 return put_luaObjectonTop(); 176 return put_luaObjectonTop();
180} 177}
181 178
@@ -368,14 +365,11 @@ void luaA_pushobject (TObject *o)
368 incr_top; 365 incr_top;
369} 366}
370 367
371void lua_pushobject (lua_Object o) 368void lua_pushobject (lua_Object o) {
372{
373 if (o == LUA_NOOBJECT) 369 if (o == LUA_NOOBJECT)
374 lua_error("API error - attempt to push a NOOBJECT"); 370 lua_error("API error - attempt to push a NOOBJECT");
375 else { 371 set_normalized(L->stack.top, Address(o));
376 set_normalized(L->stack.top, Address(o)); 372 incr_top;
377 incr_top;
378 }
379} 373}
380 374
381 375
@@ -638,16 +632,13 @@ char *lua_getobjname (lua_Object o, char **name)
638 632
639 633
640#ifndef MAX_C_BLOCKS 634#ifndef MAX_C_BLOCKS
641#define MAX_C_BLOCKS 500 635#define MAX_C_BLOCKS 1000
642#endif 636#endif
643 637
644 638
645void lua_beginblock (void) { 639void lua_beginblock (void) {
646 if (L->numCblocks >= L->sizeCblocks) { 640 luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack,
647 luaM_growvector(L->Cblocks, L->numCblocks, 1, struct C_Lua_Stack, 641 "too many nested blocks", MAX_C_BLOCKS);
648 "too many nested blocks", MAX_C_BLOCKS);
649 L->sizeCblocks++;
650 }
651 L->Cblocks[L->numCblocks] = L->Cstack; 642 L->Cblocks[L->numCblocks] = L->Cstack;
652 L->numCblocks++; 643 L->numCblocks++;
653} 644}