diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-17 16:05:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-08-17 16:05:04 -0300 |
commit | 2f2b4a42a95c7a96e5e16b74ba1167690fcd6231 (patch) | |
tree | 9a5ae551f28f24f6b9204c76cec49dc28386e16b /loadlib.c | |
parent | 074352911f3fe3102e4103c2b7140d1cf3d48492 (diff) | |
download | lua-2f2b4a42a95c7a96e5e16b74ba1167690fcd6231.tar.gz lua-2f2b4a42a95c7a96e5e16b74ba1167690fcd6231.tar.bz2 lua-2f2b4a42a95c7a96e5e16b74ba1167690fcd6231.zip |
luaL_checkudata raises an error if value is not correct
(like other luaL_check functions)
Diffstat (limited to 'loadlib.c')
-rw-r--r-- | loadlib.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.37 2005/08/10 18:06:58 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.38 2005/08/15 14:12:32 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | ** | 5 | ** |
@@ -289,10 +289,8 @@ static void **ll_register (lua_State *L, const char *path) { | |||
289 | */ | 289 | */ |
290 | static int gctm (lua_State *L) { | 290 | static int gctm (lua_State *L) { |
291 | void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); | 291 | void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); |
292 | if (lib) { | 292 | if (*lib) ll_unloadlib(*lib); |
293 | if (*lib) ll_unloadlib(*lib); | 293 | *lib = NULL; /* mark library as closed */ |
294 | *lib = NULL; /* mark library as closed */ | ||
295 | } | ||
296 | return 0; | 294 | return 0; |
297 | } | 295 | } |
298 | 296 | ||