diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-04 19:24:51 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-04 19:24:51 -0300 |
commit | 42fa305649199712aad1c96beadb944b01277e3f (patch) | |
tree | d20afcf78aebc8b7fad91ce4e3b9061c2a29b000 /lua.h | |
parent | 9319735744404831f7153653930d56826a4d2f6a (diff) | |
download | lua-42fa305649199712aad1c96beadb944b01277e3f.tar.gz lua-42fa305649199712aad1c96beadb944b01277e3f.tar.bz2 lua-42fa305649199712aad1c96beadb944b01277e3f.zip |
better error messages;
better names for some API functions.
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 30 |
1 files changed, 16 insertions, 14 deletions
@@ -2,7 +2,7 @@ | |||
2 | ** LUA - An Extensible Extension Language | 2 | ** LUA - An Extensible Extension Language |
3 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 3 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
4 | ** e-mail: lua@tecgraf.puc-rio.br | 4 | ** e-mail: lua@tecgraf.puc-rio.br |
5 | ** $Id: lua.h,v 3.42 1997/04/02 23:04:12 roberto Exp roberto $ | 5 | ** $Id: lua.h,v 4.1 1997/04/03 18:26:08 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
@@ -19,9 +19,8 @@ | |||
19 | typedef void (*lua_CFunction) (void); | 19 | typedef void (*lua_CFunction) (void); |
20 | typedef unsigned int lua_Object; | 20 | typedef unsigned int lua_Object; |
21 | 21 | ||
22 | lua_Object lua_setfallback (char *event, lua_CFunction fallback); | 22 | void lua_settagmethod (int tag, char *event, lua_CFunction method); |
23 | void lua_setintmethod (int tag, char *event, lua_CFunction method); | 23 | void lua_gettagmethod (int tag, char *event); /* out: method */ |
24 | void lua_getintmethod (int tag, char *event); /* out: method */ | ||
25 | void lua_seterrormethod (lua_CFunction method); | 24 | void lua_seterrormethod (lua_CFunction method); |
26 | 25 | ||
27 | int lua_newtag (void); | 26 | int lua_newtag (void); |
@@ -53,26 +52,26 @@ int lua_isfunction (lua_Object object); | |||
53 | float lua_getnumber (lua_Object object); | 52 | float lua_getnumber (lua_Object object); |
54 | char *lua_getstring (lua_Object object); | 53 | char *lua_getstring (lua_Object object); |
55 | lua_CFunction lua_getcfunction (lua_Object object); | 54 | lua_CFunction lua_getcfunction (lua_Object object); |
56 | void *lua_getbinarydata (lua_Object object); | 55 | void *lua_getbindata (lua_Object object); |
57 | int lua_getbindatasize (lua_Object object); | 56 | int lua_getbindatasize (lua_Object object); |
58 | 57 | ||
59 | void lua_pushnil (void); | 58 | void lua_pushnil (void); |
60 | void lua_pushnumber (float n); | 59 | void lua_pushnumber (float n); |
61 | void lua_pushstring (char *s); | 60 | void lua_pushstring (char *s); |
62 | void lua_pushcfunction (lua_CFunction fn); | 61 | void lua_pushcfunction (lua_CFunction fn); |
63 | void lua_pushbinarydata (void *buff, int size, int tag); | 62 | void lua_pushbindata (void *buff, int size, int tag); |
64 | void lua_pushusertag (void *u, int tag); | 63 | void lua_pushusertag (void *u, int tag); |
65 | void lua_pushobject (lua_Object object); | 64 | void lua_pushobject (lua_Object object); |
66 | 65 | ||
67 | lua_Object lua_getglobal (char *name); | 66 | lua_Object lua_getglobal (char *name); |
68 | lua_Object lua_basicgetglobal (char *name); | 67 | lua_Object lua_rawgetglobal (char *name); |
69 | void lua_setglobal (char *name); /* In: value */ | 68 | void lua_setglobal (char *name); /* In: value */ |
70 | void lua_basicsetglobal (char *name); /* In: value */ | 69 | void lua_rawsetglobal (char *name); /* In: value */ |
71 | 70 | ||
72 | void lua_storesubscript (void); /* In: table, index, value */ | 71 | void lua_settable (void); /* In: table, index, value */ |
73 | void lua_basicstoreindex (void); /* In: table, index, value */ | 72 | void lua_rawsettable (void); /* In: table, index, value */ |
74 | lua_Object lua_getsubscript (void); /* In: table, index */ | 73 | lua_Object lua_gettable (void); /* In: table, index */ |
75 | lua_Object lua_basicindex (void); /* In: table, index */ | 74 | lua_Object lua_rawgettable (void); /* In: table, index */ |
76 | 75 | ||
77 | int lua_tag (lua_Object object); | 76 | int lua_tag (lua_Object object); |
78 | 77 | ||
@@ -98,6 +97,8 @@ lua_Object lua_createtable (void); | |||
98 | /* =============================================================== */ | 97 | /* =============================================================== */ |
99 | /* for compatibility with old versions. Avoid using these macros/functions */ | 98 | /* for compatibility with old versions. Avoid using these macros/functions */ |
100 | 99 | ||
100 | lua_Object lua_setfallback (char *event, lua_CFunction fallback); | ||
101 | |||
101 | #define lua_storeglobal(n) lua_setglobal(n) | 102 | #define lua_storeglobal(n) lua_setglobal(n) |
102 | #define lua_type(o) (lua_tag(o)) | 103 | #define lua_type(o) (lua_tag(o)) |
103 | 104 | ||
@@ -111,9 +112,10 @@ void *lua_getuserdata (lua_Object object); | |||
111 | 112 | ||
112 | #define lua_pushliteral(o) lua_pushstring(o) | 113 | #define lua_pushliteral(o) lua_pushstring(o) |
113 | 114 | ||
114 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript()) | 115 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_gettable()) |
115 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript()) | 116 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_gettable()) |
116 | 117 | ||
117 | #define lua_copystring(o) (strdup(lua_getstring(o))) | 118 | #define lua_copystring(o) (strdup(lua_getstring(o))) |
118 | 119 | ||
120 | #define lua_getsubscript lua_gettable | ||
119 | #endif | 121 | #endif |