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 | |
parent | 5e60b961deb0d70935c6b1ec6e92eb7b9f9be75b (diff) | |
download | lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.gz lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.bz2 lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.zip |
new API function to create tables
-rw-r--r-- | lua.h | 5 | ||||
-rw-r--r-- | opcode.c | 14 |
2 files changed, 16 insertions, 3 deletions
@@ -2,7 +2,7 @@ | |||
2 | ** LUA - Linguagem para Usuarios de Aplicacao | 2 | ** LUA - Linguagem para Usuarios de Aplicacao |
3 | ** Grupo de Tecnologia em Computacao Grafica | 3 | ** Grupo de Tecnologia em Computacao Grafica |
4 | ** TeCGraf - PUC-Rio | 4 | ** TeCGraf - PUC-Rio |
5 | ** $Id: lua.h,v 3.5 1994/11/08 19:56:39 roberto Exp roberto $ | 5 | ** $Id: lua.h,v 3.6 1994/11/09 18:10:11 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
@@ -38,7 +38,7 @@ int lua_callfunction (lua_Object function); | |||
38 | int lua_call (char *funcname); | 38 | int lua_call (char *funcname); |
39 | 39 | ||
40 | lua_Object lua_getparam (int number); | 40 | lua_Object lua_getparam (int number); |
41 | #define lua_getresult lua_getparam | 41 | #define lua_getresult(_) lua_getparam(_) |
42 | 42 | ||
43 | float lua_getnumber (lua_Object object); | 43 | float lua_getnumber (lua_Object object); |
44 | char *lua_getstring (lua_Object object); | 44 | char *lua_getstring (lua_Object object); |
@@ -65,6 +65,7 @@ int lua_lock (lua_Object object); | |||
65 | lua_Object lua_getlocked (int ref); | 65 | lua_Object lua_getlocked (int ref); |
66 | void lua_unlock (int ref); | 66 | void lua_unlock (int ref); |
67 | 67 | ||
68 | lua_Object lua_createTable (int initSize); | ||
68 | 69 | ||
69 | /* for lua 1.1 */ | 70 | /* for lua 1.1 */ |
70 | 71 | ||
@@ -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. |