diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-26 12:57:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2007-03-26 12:57:35 -0300 |
commit | df50c84ee0453a2d68e85a6b84a9fc4bc93d881e (patch) | |
tree | 9b7893a275fd2497794701257bb92b37b90257f6 /loadlib.c | |
parent | 1a455acc81463489c9e08f037cc71dc61b54935c (diff) | |
download | lua-df50c84ee0453a2d68e85a6b84a9fc4bc93d881e.tar.gz lua-df50c84ee0453a2d68e85a6b84a9fc4bc93d881e.tar.bz2 lua-df50c84ee0453a2d68e85a6b84a9fc4bc93d881e.zip |
BUG: loadlib should not use Lua internals (lobject.h)
Diffstat (limited to 'loadlib.c')
-rw-r--r-- | loadlib.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.55 2006/09/11 14:07:24 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.56 2006/10/10 17:40:17 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 | ** |
@@ -16,9 +16,9 @@ | |||
16 | #define loadlib_c | 16 | #define loadlib_c |
17 | #define LUA_LIB | 17 | #define LUA_LIB |
18 | 18 | ||
19 | #include "lauxlib.h" | ||
20 | #include "lobject.h" | ||
21 | #include "lua.h" | 19 | #include "lua.h" |
20 | |||
21 | #include "lauxlib.h" | ||
22 | #include "lualib.h" | 22 | #include "lualib.h" |
23 | 23 | ||
24 | 24 | ||
@@ -361,7 +361,7 @@ static const char *findfile (lua_State *L, const char *name, | |||
361 | lua_remove(L, -2); /* remove path template */ | 361 | lua_remove(L, -2); /* remove path template */ |
362 | if (readable(filename)) /* does file exist and is readable? */ | 362 | if (readable(filename)) /* does file exist and is readable? */ |
363 | return filename; /* return that file name */ | 363 | return filename; /* return that file name */ |
364 | luaO_pushfstring(L, "\n\tno file " LUA_QS, filename); | 364 | lua_pushfstring(L, "\n\tno file " LUA_QS, filename); |
365 | lua_remove(L, -2); /* remove file name */ | 365 | lua_remove(L, -2); /* remove file name */ |
366 | lua_concat(L, 2); /* add entry to possible error message */ | 366 | lua_concat(L, 2); /* add entry to possible error message */ |
367 | } | 367 | } |
@@ -422,8 +422,8 @@ static int loader_Croot (lua_State *L) { | |||
422 | funcname = mkfuncname(L, name); | 422 | funcname = mkfuncname(L, name); |
423 | if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { | 423 | if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { |
424 | if (stat != ERRFUNC) loaderror(L, filename); /* real error */ | 424 | if (stat != ERRFUNC) loaderror(L, filename); /* real error */ |
425 | luaO_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, | 425 | lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, |
426 | name, filename); | 426 | name, filename); |
427 | return 1; /* function not found */ | 427 | return 1; /* function not found */ |
428 | } | 428 | } |
429 | return 1; | 429 | return 1; |
@@ -437,7 +437,7 @@ static int loader_preload (lua_State *L) { | |||
437 | luaL_error(L, LUA_QL("package.preload") " must be a table"); | 437 | luaL_error(L, LUA_QL("package.preload") " must be a table"); |
438 | lua_getfield(L, -1, name); | 438 | lua_getfield(L, -1, name); |
439 | if (lua_isnil(L, -1)) /* not found? */ | 439 | if (lua_isnil(L, -1)) /* not found? */ |
440 | luaO_pushfstring(L, "\n\tno field package.preload['%s']", name); | 440 | lua_pushfstring(L, "\n\tno field package.preload['%s']", name); |
441 | return 1; | 441 | return 1; |
442 | } | 442 | } |
443 | 443 | ||