aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-13 14:17:04 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-13 14:17:04 -0200
commite1d91fd0e185e295fa15dd508580d3c8d4636960 (patch)
treed56bb171b4fcb0116d05fe4bccfde6357fe75127
parent5e60b961deb0d70935c6b1ec6e92eb7b9f9be75b (diff)
downloadlua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.gz
lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.tar.bz2
lua-e1d91fd0e185e295fa15dd508580d3c8d4636960.zip
new API function to create tables
-rw-r--r--lua.h5
-rw-r--r--opcode.c14
2 files changed, 16 insertions, 3 deletions
diff --git a/lua.h b/lua.h
index f53c091d..3affdb53 100644
--- a/lua.h
+++ b/lua.h
@@ -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);
38int lua_call (char *funcname); 38int lua_call (char *funcname);
39 39
40lua_Object lua_getparam (int number); 40lua_Object lua_getparam (int number);
41#define lua_getresult lua_getparam 41#define lua_getresult(_) lua_getparam(_)
42 42
43float lua_getnumber (lua_Object object); 43float lua_getnumber (lua_Object object);
44char *lua_getstring (lua_Object object); 44char *lua_getstring (lua_Object object);
@@ -65,6 +65,7 @@ int lua_lock (lua_Object object);
65lua_Object lua_getlocked (int ref); 65lua_Object lua_getlocked (int ref);
66void lua_unlock (int ref); 66void lua_unlock (int ref);
67 67
68lua_Object lua_createTable (int initSize);
68 69
69/* for lua 1.1 */ 70/* for lua 1.1 */
70 71
diff --git a/opcode.c b/opcode.c
index 6625f51e..263e9035 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 3.9 1994/11/10 17:36:54 roberto Exp roberto $"; 6char *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*/
465lua_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.