diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-24 19:39:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-07-24 19:39:34 -0300 |
commit | ebd1d1f82c12736565b7c471f0dd4f3904724e1d (patch) | |
tree | 016a4c0411e9998db99ca29624a4c310122133a5 /ltm.c | |
parent | 04320e04bf6d6649e4dffe2233ebc72d5bbb6965 (diff) | |
download | lua-ebd1d1f82c12736565b7c471f0dd4f3904724e1d.tar.gz lua-ebd1d1f82c12736565b7c471f0dd4f3904724e1d.tar.bz2 lua-ebd1d1f82c12736565b7c471f0dd4f3904724e1d.zip |
no more deprecated code
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.74 2001/07/12 18:11:58 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.75 2001/07/23 19:56:00 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -21,9 +21,10 @@ | |||
21 | 21 | ||
22 | 22 | ||
23 | const l_char *const luaT_eventname[] = { /* ORDER TM */ | 23 | const l_char *const luaT_eventname[] = { /* ORDER TM */ |
24 | l_s("gettable"), l_s("settable"), l_s("index"), l_s("getglobal"), l_s("setglobal"), l_s("add"), l_s("sub"), | 24 | l_s("gettable"), l_s("settable"), l_s("index"), l_s("getglobal"), |
25 | l_s("mul"), l_s("div"), l_s("pow"), l_s("unm"), l_s("lt"), l_s("concat"), l_s("gc"), l_s("function"), | 25 | l_s("setglobal"), l_s("add"), l_s("sub"), l_s("mul"), l_s("div"), |
26 | l_s("le"), l_s("gt"), l_s("ge"), /* deprecated options!! */ | 26 | l_s("pow"), l_s("unm"), l_s("lt"), l_s("concat"), l_s("gc"), |
27 | l_s("function"), | ||
27 | NULL | 28 | NULL |
28 | }; | 29 | }; |
29 | 30 | ||
@@ -37,12 +38,8 @@ static int findevent (const l_char *name) { | |||
37 | } | 38 | } |
38 | 39 | ||
39 | 40 | ||
40 | static int luaI_checkevent (lua_State *L, const l_char *name, int t) { | 41 | static int luaI_checkevent (lua_State *L, const l_char *name) { |
41 | int e = findevent(name); | 42 | int e = findevent(name); |
42 | if (e >= TM_N) | ||
43 | luaO_verror(L, l_s("event `%.50s' is deprecated"), name); | ||
44 | if (e == TM_GC && t == LUA_TTABLE) | ||
45 | luaO_verror(L, l_s("event `gc' for tables is deprecated")); | ||
46 | if (e < 0) | 43 | if (e < 0) |
47 | luaO_verror(L, l_s("`%.50s' is not a valid event name"), name); | 44 | luaO_verror(L, l_s("`%.50s' is not a valid event name"), name); |
48 | return e; | 45 | return e; |
@@ -157,7 +154,7 @@ const l_char *luaT_typename (global_State *G, const TObject *o) { | |||
157 | LUA_API void lua_gettagmethod (lua_State *L, int t, const l_char *event) { | 154 | LUA_API void lua_gettagmethod (lua_State *L, int t, const l_char *event) { |
158 | int e; | 155 | int e; |
159 | lua_lock(L); | 156 | lua_lock(L); |
160 | e = luaI_checkevent(L, event, t); | 157 | e = luaI_checkevent(L, event); |
161 | checktag(L, t); | 158 | checktag(L, t); |
162 | if (luaT_validevent(t, e) && luaT_gettm(G(L), t, e)) { | 159 | if (luaT_validevent(t, e) && luaT_gettm(G(L), t, e)) { |
163 | setclvalue(L->top, luaT_gettm(G(L), t, e)); | 160 | setclvalue(L->top, luaT_gettm(G(L), t, e)); |
@@ -172,7 +169,7 @@ LUA_API void lua_gettagmethod (lua_State *L, int t, const l_char *event) { | |||
172 | LUA_API void lua_settagmethod (lua_State *L, int t, const l_char *event) { | 169 | LUA_API void lua_settagmethod (lua_State *L, int t, const l_char *event) { |
173 | int e; | 170 | int e; |
174 | lua_lock(L); | 171 | lua_lock(L); |
175 | e = luaI_checkevent(L, event, t); | 172 | e = luaI_checkevent(L, event); |
176 | checktag(L, t); | 173 | checktag(L, t); |
177 | if (!luaT_validevent(t, e)) | 174 | if (!luaT_validevent(t, e)) |
178 | luaO_verror(L, l_s("cannot change `%.20s' tag method for type `%.20s'%.20s"), | 175 | luaO_verror(L, l_s("cannot change `%.20s' tag method for type `%.20s'%.20s"), |