diff options
-rw-r--r-- | loadlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.73 2010/01/06 14:35:17 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.74 2010/01/11 16:10:47 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 | ** |
@@ -344,7 +344,9 @@ static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { | |||
344 | lua_CFunction f = ll_sym(L, *reg, sym); | 344 | lua_CFunction f = ll_sym(L, *reg, sym); |
345 | if (f == NULL) | 345 | if (f == NULL) |
346 | return ERRFUNC; /* unable to find function */ | 346 | return ERRFUNC; /* unable to find function */ |
347 | lua_pushcfunction(L, f); /* else return function */ | 347 | lua_pushcfunction(L, f); /* else create new function... */ |
348 | lua_pushglobaltable(L); /* ... and set the standard global table... */ | ||
349 | lua_setfenv(L, -2); /* ... as its environment */ | ||
348 | return 0; /* no errors */ | 350 | return 0; /* no errors */ |
349 | } | 351 | } |
350 | } | 352 | } |