aboutsummaryrefslogtreecommitdiff
path: root/opcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-01 16:25:20 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-01 16:25:20 -0200
commitf53460aab94c64879624c72222e282fe492122ae (patch)
tree9844b4e8b71da8034f976159dc83714c5bdcefde /opcode.c
parent41e4c5798ee95404f6687def4bbed236566db676 (diff)
downloadlua-f53460aab94c64879624c72222e282fe492122ae.tar.gz
lua-f53460aab94c64879624c72222e282fe492122ae.tar.bz2
lua-f53460aab94c64879624c72222e282fe492122ae.zip
CREATEARRAY now has an argument, the size of the array to create.
Diffstat (limited to 'opcode.c')
-rw-r--r--opcode.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/opcode.c b/opcode.c
index c356bde5..9531f558 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 2.10 1994/10/17 19:00:40 celes Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 2.11 1994/11/01 17:54:31 roberto Exp roberto $";
7 7
8#include <stdio.h> 8#include <stdio.h>
9#include <stdlib.h> 9#include <stdlib.h>
@@ -346,17 +346,15 @@ int lua_execute (Byte *pc)
346 break; 346 break;
347 347
348 case CREATEARRAY: 348 case CREATEARRAY:
349 if (tag(top-1) == T_NIL) 349 {
350 nvalue(top-1) = 1; 350 CodeWord size;
351 else 351 get_word(size,pc);
352 { 352 top++;
353 if (tonumber(top-1)) return 1; 353 avalue(top-1) = lua_createarray(size.w);
354 if (nvalue(top-1) <= 0) nvalue(top-1) = 1;
355 }
356 avalue(top-1) = lua_createarray(nvalue(top-1));
357 if (avalue(top-1) == NULL) 354 if (avalue(top-1) == NULL)
358 return 1; 355 return 1;
359 tag(top-1) = T_ARRAY; 356 tag(top-1) = T_ARRAY;
357 }
360 break; 358 break;
361 359
362 case EQOP: 360 case EQOP: