aboutsummaryrefslogtreecommitdiff
path: root/lua.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-07 14:34:44 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-11-07 14:34:44 -0200
commitd95a8b312166752e2211678b33514edb1d68a0a6 (patch)
tree87a7180705c1c5e6db71831fb8cb49ce8980f4d0 /lua.h
parent9ffba7a3dbdfa68595cd8cec26bd99689ce5fd08 (diff)
downloadlua-d95a8b312166752e2211678b33514edb1d68a0a6.tar.gz
lua-d95a8b312166752e2211678b33514edb1d68a0a6.tar.bz2
lua-d95a8b312166752e2211678b33514edb1d68a0a6.zip
new API: lua_Object now is an integer
Diffstat (limited to 'lua.h')
-rw-r--r--lua.h28
1 files changed, 12 insertions, 16 deletions
diff --git a/lua.h b/lua.h
index 098b225a..0f320dce 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.1 1994/11/02 20:30:53 roberto Exp roberto $ 5** $Id: lua.h,v 3.2 1994/11/04 10:47:49 roberto Exp roberto $
6*/ 6*/
7 7
8 8
@@ -21,56 +21,52 @@ typedef enum
21 LUA_T_FUNCTION, 21 LUA_T_FUNCTION,
22 LUA_T_CFUNCTION, 22 LUA_T_CFUNCTION,
23 LUA_T_USERDATA 23 LUA_T_USERDATA
24} Type; 24} lua_Type;
25 25
26 26
27/* Public Part */ 27/* Public Part */
28 28
29typedef void (*lua_CFunction) (void); 29typedef void (*lua_CFunction) (void);
30typedef struct Object *lua_Object; 30typedef unsigned int lua_Object;
31 31
32#define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n))
33
34void lua_errorfunction (void (*fn) (char *s));
35void lua_error (char *s); 32void lua_error (char *s);
36int lua_dofile (char *filename); 33int lua_dofile (char *filename);
37int lua_dostring (char *string); 34int lua_dostring (char *string);
38int lua_callfunction (lua_Object function); 35int lua_callfunction (lua_Object function);
39 36
40lua_Object lua_getparam (int number); 37lua_Object lua_getparam (int number);
38#define lua_getresult lua_getparam
39
41float lua_getnumber (lua_Object object); 40float lua_getnumber (lua_Object object);
42char *lua_getstring (lua_Object object); 41char *lua_getstring (lua_Object object);
43char *lua_copystring (lua_Object object); 42char *lua_copystring (lua_Object object);
44lua_CFunction lua_getcfunction (lua_Object object); 43lua_CFunction lua_getcfunction (lua_Object object);
45void *lua_getuserdata (lua_Object object); 44void *lua_getuserdata (lua_Object object);
46void *lua_gettable (lua_Object object);
47lua_Object lua_getfield (lua_Object object, char *field);
48lua_Object lua_getindexed (lua_Object object, float index);
49lua_Object lua_getglobal (char *name);
50 45
51int lua_pushnil (void); 46int lua_pushnil (void);
52int lua_pushnumber (float n); 47int lua_pushnumber (float n);
53int lua_pushstring (char *s); 48int lua_pushstring (char *s);
54int lua_pushcfunction (lua_CFunction fn); 49int lua_pushcfunction (lua_CFunction fn);
55int lua_pushuserdata (void *u); 50int lua_pushuserdata (void *u);
56int lua_pushtable (void *t);
57int lua_pushsubscript (void);
58int lua_pushobject (lua_Object object); 51int lua_pushobject (lua_Object object);
59 52
53lua_Object lua_getglobal (char *name);
60int lua_storeglobal (char *name); 54int lua_storeglobal (char *name);
61int lua_storefield (lua_Object object, char *field); 55
62int lua_storeindexed (lua_Object object, float index);
63int lua_storesubscript (void); 56int lua_storesubscript (void);
57lua_Object lua_getIndex (void);
64 58
65int lua_type (lua_Object object); 59int lua_type (lua_Object object);
66 60
67 61
68/* for lua 1.1 */ 62/* for lua 1.1 */
69 63
64#define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n))
65
70#define lua_call(f) lua_callfunction(lua_getglobal(f)) 66#define lua_call(f) lua_callfunction(lua_getglobal(f))
71 67
72#define lua_getindexed(o,n) (lua_pushnumber(n), lua_getIndex(o)) 68#define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getIndex())
73#define lua_getfield(o,f) (lua_pushstring(f), lua_getIndex(o)) 69#define lua_getfield(o,f) (lua_pushobject(o), lua_pushstring(f), lua_getIndex())
74 70
75#define lua_isnil(_) (lua_type(_)==LUA_T_NIL) 71#define lua_isnil(_) (lua_type(_)==LUA_T_NIL)
76#define lua_isnumber(_) (lua_type(_)==LUA_T_NUMBER) 72#define lua_isnumber(_) (lua_type(_)==LUA_T_NUMBER)