diff options
Diffstat (limited to '')
| -rw-r--r-- | lua.h | 28 |
1 files changed, 12 insertions, 16 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.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 | ||
| 29 | typedef void (*lua_CFunction) (void); | 29 | typedef void (*lua_CFunction) (void); |
| 30 | typedef struct Object *lua_Object; | 30 | typedef unsigned int lua_Object; |
| 31 | 31 | ||
| 32 | #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n)) | ||
| 33 | |||
| 34 | void lua_errorfunction (void (*fn) (char *s)); | ||
| 35 | void lua_error (char *s); | 32 | void lua_error (char *s); |
| 36 | int lua_dofile (char *filename); | 33 | int lua_dofile (char *filename); |
| 37 | int lua_dostring (char *string); | 34 | int lua_dostring (char *string); |
| 38 | int lua_callfunction (lua_Object function); | 35 | int lua_callfunction (lua_Object function); |
| 39 | 36 | ||
| 40 | lua_Object lua_getparam (int number); | 37 | lua_Object lua_getparam (int number); |
| 38 | #define lua_getresult lua_getparam | ||
| 39 | |||
| 41 | float lua_getnumber (lua_Object object); | 40 | float lua_getnumber (lua_Object object); |
| 42 | char *lua_getstring (lua_Object object); | 41 | char *lua_getstring (lua_Object object); |
| 43 | char *lua_copystring (lua_Object object); | 42 | char *lua_copystring (lua_Object object); |
| 44 | lua_CFunction lua_getcfunction (lua_Object object); | 43 | lua_CFunction lua_getcfunction (lua_Object object); |
| 45 | void *lua_getuserdata (lua_Object object); | 44 | void *lua_getuserdata (lua_Object object); |
| 46 | void *lua_gettable (lua_Object object); | ||
| 47 | lua_Object lua_getfield (lua_Object object, char *field); | ||
| 48 | lua_Object lua_getindexed (lua_Object object, float index); | ||
| 49 | lua_Object lua_getglobal (char *name); | ||
| 50 | 45 | ||
| 51 | int lua_pushnil (void); | 46 | int lua_pushnil (void); |
| 52 | int lua_pushnumber (float n); | 47 | int lua_pushnumber (float n); |
| 53 | int lua_pushstring (char *s); | 48 | int lua_pushstring (char *s); |
| 54 | int lua_pushcfunction (lua_CFunction fn); | 49 | int lua_pushcfunction (lua_CFunction fn); |
| 55 | int lua_pushuserdata (void *u); | 50 | int lua_pushuserdata (void *u); |
| 56 | int lua_pushtable (void *t); | ||
| 57 | int lua_pushsubscript (void); | ||
| 58 | int lua_pushobject (lua_Object object); | 51 | int lua_pushobject (lua_Object object); |
| 59 | 52 | ||
| 53 | lua_Object lua_getglobal (char *name); | ||
| 60 | int lua_storeglobal (char *name); | 54 | int lua_storeglobal (char *name); |
| 61 | int lua_storefield (lua_Object object, char *field); | 55 | |
| 62 | int lua_storeindexed (lua_Object object, float index); | ||
| 63 | int lua_storesubscript (void); | 56 | int lua_storesubscript (void); |
| 57 | lua_Object lua_getIndex (void); | ||
| 64 | 58 | ||
| 65 | int lua_type (lua_Object object); | 59 | int 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) |
