From 2f2b4a42a95c7a96e5e16b74ba1167690fcd6231 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 17 Aug 2005 16:05:04 -0300 Subject: luaL_checkudata raises an error if value is not correct (like other luaL_check functions) --- loadlib.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'loadlib.c') diff --git a/loadlib.c b/loadlib.c index d50a587a..81d46172 100644 --- a/loadlib.c +++ b/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.37 2005/08/10 18:06:58 roberto Exp roberto $ +** $Id: loadlib.c,v 1.38 2005/08/15 14:12:32 roberto Exp roberto $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -289,10 +289,8 @@ static void **ll_register (lua_State *L, const char *path) { */ static int gctm (lua_State *L) { void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); - if (lib) { - if (*lib) ll_unloadlib(*lib); - *lib = NULL; /* mark library as closed */ - } + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ return 0; } -- cgit v1.2.3-55-g6feb