diff options
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 35 |
1 files changed, 9 insertions, 26 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.32 1996/11/20 13:49:32 roberto Exp roberto $ | 5 | ** $Id: lua.h,v 3.33 1997/02/11 11:40:01 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
@@ -14,25 +14,6 @@ | |||
14 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" | 14 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" |
15 | 15 | ||
16 | 16 | ||
17 | /* Private Part */ | ||
18 | |||
19 | typedef enum | ||
20 | { | ||
21 | LUA_T_NIL = -1, | ||
22 | LUA_T_NUMBER = -2, | ||
23 | LUA_T_STRING = -3, | ||
24 | LUA_T_ARRAY = -4, | ||
25 | LUA_T_FUNCTION = -5, | ||
26 | LUA_T_CFUNCTION= -6, | ||
27 | LUA_T_MARK = -7, | ||
28 | LUA_T_CMARK = -8, | ||
29 | LUA_T_LINE = -9, | ||
30 | LUA_T_USERDATA = 0 | ||
31 | } lua_Type; | ||
32 | |||
33 | |||
34 | /* Public Part */ | ||
35 | |||
36 | #define LUA_NOOBJECT 0 | 17 | #define LUA_NOOBJECT 0 |
37 | 18 | ||
38 | typedef void (*lua_CFunction) (void); | 19 | typedef void (*lua_CFunction) (void); |
@@ -52,10 +33,10 @@ void lua_endblock (void); | |||
52 | lua_Object lua_getparam (int number); | 33 | lua_Object lua_getparam (int number); |
53 | #define lua_getresult(_) lua_getparam(_) | 34 | #define lua_getresult(_) lua_getparam(_) |
54 | 35 | ||
55 | #define lua_isnil(_) (lua_type(_)==LUA_T_NIL) | 36 | int lua_isnil (lua_Object object); |
56 | #define lua_istable(_) (lua_type(_)==LUA_T_ARRAY) | 37 | int lua_istable (lua_Object object); |
57 | #define lua_isuserdata(_) (lua_type(_)>=LUA_T_USERDATA) | 38 | int lua_isuserdata (lua_Object object); |
58 | #define lua_iscfunction(_) (lua_type(_)==LUA_T_CFUNCTION) | 39 | int lua_iscfunction (lua_Object object); |
59 | int lua_isnumber (lua_Object object); | 40 | int lua_isnumber (lua_Object object); |
60 | int lua_isstring (lua_Object object); | 41 | int lua_isstring (lua_Object object); |
61 | int lua_isfunction (lua_Object object); | 42 | int lua_isfunction (lua_Object object); |
@@ -65,7 +46,6 @@ char *lua_getstring (lua_Object object); | |||
65 | lua_CFunction lua_getcfunction (lua_Object object); | 46 | lua_CFunction lua_getcfunction (lua_Object object); |
66 | void *lua_getbinarydata (lua_Object object); | 47 | void *lua_getbinarydata (lua_Object object); |
67 | int lua_getbindatasize (lua_Object object); | 48 | int lua_getbindatasize (lua_Object object); |
68 | void *lua_getuserdata (lua_Object object); | ||
69 | 49 | ||
70 | void lua_pushnil (void); | 50 | void lua_pushnil (void); |
71 | void lua_pushnumber (float n); | 51 | void lua_pushnumber (float n); |
@@ -98,11 +78,14 @@ lua_Object lua_createtable (void); | |||
98 | 78 | ||
99 | #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n)) | 79 | #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n)) |
100 | 80 | ||
101 | #define lua_pushuserdata(u) lua_pushusertag(u, LUA_T_USERDATA) | 81 | #define lua_pushuserdata(u) lua_pushusertag(u, 0) |
82 | |||
102 | 83 | ||
103 | 84 | ||
104 | /* for compatibility with old versions. Avoid using these macros */ | 85 | /* for compatibility with old versions. Avoid using these macros */ |
105 | 86 | ||
87 | #define lua_getuserdata(o) (*(void **)lua_getbinarydata(o)) | ||
88 | |||
106 | #define lua_lockobject(o) lua_refobject(o,1) | 89 | #define lua_lockobject(o) lua_refobject(o,1) |
107 | #define lua_lock() lua_ref(1) | 90 | #define lua_lock() lua_ref(1) |
108 | #define lua_getlocked lua_getref | 91 | #define lua_getlocked lua_getref |