From a66404aca612b68def99db6c7daba549a8bba4b8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 17 Oct 1995 12:30:05 -0200 Subject: function "setfallback" now gives an error if called with wrong parameters. --- fallback.c | 9 +++------ opcode.c | 8 +++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fallback.c b/fallback.c index ba88a22f..e7f6a8bf 100644 --- a/fallback.c +++ b/fallback.c @@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_fallback="$Id: fallback.c,v 1.15 1995/10/09 13:14:29 roberto Exp roberto $"; +char *rcs_fallback="$Id: fallback.c,v 1.16 1995/10/17 11:52:38 roberto Exp roberto $"; #include #include @@ -48,10 +48,7 @@ void luaI_setfallback (void) char *name = lua_getstring(lua_getparam(1)); lua_Object func = lua_getparam(2); if (name == NULL || !(lua_isfunction(func) || lua_iscfunction(func))) - { - lua_pushnil(); - return; - } + lua_error("incorrect argument to function `setfallback'"); for (i=0; i #include @@ -500,8 +500,10 @@ lua_Object lua_setfallback (char *name, lua_CFunction fallback) stack[CBase].value.f = luaI_setfallback; lua_pushstring(name); lua_pushcfunction(fallback); - do_protectedrun(1); - return (Ref(top-1)); + if (do_protectedrun(1) == 0) + return (Ref(top-1)); + else + return LUA_NOOBJECT; } -- cgit v1.2.3-55-g6feb