diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-06 11:08:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-06 11:08:08 -0300 |
commit | 3a9516ffc8de0d33051f83dc786dba615d6bac49 (patch) | |
tree | 9608796ca5abb4a724d70d99cb34dd818eb95662 /fallback.c | |
parent | 42fa305649199712aad1c96beadb944b01277e3f (diff) | |
download | lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.tar.gz lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.tar.bz2 lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.zip |
luaL check functions do not need the function name (it can be
accessed via luadebug interface).
Diffstat (limited to 'fallback.c')
-rw-r--r-- | fallback.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_fallback="$Id: fallback.c,v 2.1 1997/04/03 18:24:23 roberto Exp roberto $"; | 6 | char *rcs_fallback="$Id: fallback.c,v 2.2 1997/04/04 22:24:51 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -227,8 +227,8 @@ TObject *luaI_getim (int tag, IMS event) | |||
227 | 227 | ||
228 | void luaI_gettagmethod (void) | 228 | void luaI_gettagmethod (void) |
229 | { | 229 | { |
230 | int t = (int)luaL_check_number(1, "gettagmethod"); | 230 | int t = (int)luaL_check_number(1); |
231 | int e = luaI_checkevent(luaL_check_string(2, "gettagmethod"), luaI_eventname); | 231 | int e = luaI_checkevent(luaL_check_string(2), luaI_eventname); |
232 | checktag(t); | 232 | checktag(t); |
233 | if (validevent(t, e)) | 233 | if (validevent(t, e)) |
234 | luaI_pushobject(&luaI_IMtable[-t].int_method[e]); | 234 | luaI_pushobject(&luaI_IMtable[-t].int_method[e]); |
@@ -237,14 +237,14 @@ void luaI_gettagmethod (void) | |||
237 | 237 | ||
238 | void luaI_settagmethod (void) | 238 | void luaI_settagmethod (void) |
239 | { | 239 | { |
240 | int t = (int)luaL_check_number(1, "settagmethod"); | 240 | int t = (int)luaL_check_number(1); |
241 | int e = luaI_checkevent(luaL_check_string(2, "settagmethod"), luaI_eventname); | 241 | int e = luaI_checkevent(luaL_check_string(2), luaI_eventname); |
242 | lua_Object func = lua_getparam(3); | 242 | lua_Object func = lua_getparam(3); |
243 | checktag(t); | 243 | checktag(t); |
244 | if (!validevent(t, e)) | 244 | if (!validevent(t, e)) |
245 | luaL_verror("cannot change internal method `%s' for tag %d", | 245 | luaL_verror("cannot change internal method `%s' for tag %d", |
246 | luaI_eventname[e], t); | 246 | luaI_eventname[e], t); |
247 | luaL_arg_check(lua_isnil(func) || lua_isfunction(func), "settagmethod", | 247 | luaL_arg_check(lua_isnil(func) || lua_isfunction(func), |
248 | 3, "function expected"); | 248 | 3, "function expected"); |
249 | luaI_pushobject(&luaI_IMtable[-t].int_method[e]); | 249 | luaI_pushobject(&luaI_IMtable[-t].int_method[e]); |
250 | luaI_IMtable[-t].int_method[e] = *luaI_Address(func); | 250 | luaI_IMtable[-t].int_method[e] = *luaI_Address(func); |
@@ -262,7 +262,7 @@ TObject *luaI_geterrorim (void) | |||
262 | void luaI_seterrormethod (void) | 262 | void luaI_seterrormethod (void) |
263 | { | 263 | { |
264 | lua_Object func = lua_getparam(1); | 264 | lua_Object func = lua_getparam(1); |
265 | luaL_arg_check(lua_isnil(func) || lua_isfunction(func), "seterrormethod", | 265 | luaL_arg_check(lua_isnil(func) || lua_isfunction(func), |
266 | 1, "function expected"); | 266 | 1, "function expected"); |
267 | luaI_pushobject(&errorim); | 267 | luaI_pushobject(&errorim); |
268 | errorim = *luaI_Address(func); | 268 | errorim = *luaI_Address(func); |
@@ -321,10 +321,10 @@ void luaI_setfallback (void) | |||
321 | int e; | 321 | int e; |
322 | TObject oldfunc; | 322 | TObject oldfunc; |
323 | lua_CFunction replace; | 323 | lua_CFunction replace; |
324 | char *name = luaL_check_string(1, "setfallback"); | 324 | char *name = luaL_check_string(1); |
325 | lua_Object func = lua_getparam(2); | 325 | lua_Object func = lua_getparam(2); |
326 | luaI_initfallbacks(); | 326 | luaI_initfallbacks(); |
327 | luaL_arg_check(lua_isfunction(func), "setfallback", 2, "function expected"); | 327 | luaL_arg_check(lua_isfunction(func), 2, "function expected"); |
328 | if (strcmp(name, "error") == 0) { /* old error fallback */ | 328 | if (strcmp(name, "error") == 0) { /* old error fallback */ |
329 | oldfunc = errorim; | 329 | oldfunc = errorim; |
330 | errorim = *luaI_Address(func); | 330 | errorim = *luaI_Address(func); |