diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-13 14:17:04 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-13 14:17:04 -0200 |
| commit | e1d91fd0e185e295fa15dd508580d3c8d4636960 (patch) | |
| tree | d56bb171b4fcb0116d05fe4bccfde6357fe75127 /opcode.c | |
| parent | 5e60b961deb0d70935c6b1ec6e92eb7b9f9be75b (diff) | |
| download | lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.gz lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.bz2 lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.zip | |
new API function to create tables
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 3.9 1994/11/10 17:36:54 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.10 1994/11/11 14:00:08 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| @@ -459,6 +459,18 @@ int lua_storesubscript (void) | |||
| 459 | return(do_protectedrun(&func, 0)); | 459 | return(do_protectedrun(&func, 0)); |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | /* | ||
| 463 | ** API: creates a new table | ||
| 464 | */ | ||
| 465 | lua_Object lua_createTable (int initSize) | ||
| 466 | { | ||
| 467 | adjustC(0); | ||
| 468 | top++; | ||
| 469 | tag(top-1) = LUA_T_ARRAY; | ||
| 470 | avalue(top-1) = lua_createarray(initSize); | ||
| 471 | CBase++; /* incorporate object in the stack */ | ||
| 472 | return Ref(top-1); | ||
| 473 | } | ||
| 462 | 474 | ||
| 463 | /* | 475 | /* |
| 464 | ** Get a parameter, returning the object handle or 0 on error. | 476 | ** Get a parameter, returning the object handle or 0 on error. |
