diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-06 11:59:12 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-06 11:59:12 -0200 |
| commit | 6d8d282e0f6fc74f2499a9ab3971613115fdf0f9 (patch) | |
| tree | fac78387ac6a8a7e80418be2cd76936e00153ee5 | |
| parent | 00c8a17a2da8fbeaf5b5542c0b7a0c4dd4fdfc91 (diff) | |
| download | lua-6d8d282e0f6fc74f2499a9ab3971613115fdf0f9.tar.gz lua-6d8d282e0f6fc74f2499a9ab3971613115fdf0f9.tar.bz2 lua-6d8d282e0f6fc74f2499a9ab3971613115fdf0f9.zip | |
avoid calling "extra value" as if it were a function option
| -rw-r--r-- | loadlib.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loadlib.c,v 1.99 2011/06/28 17:13:28 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.100 2011/07/05 12:49:35 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 | ** |
| @@ -516,9 +516,11 @@ static void set_env (lua_State *L) { | |||
| 516 | static void dooptions (lua_State *L, int n) { | 516 | static void dooptions (lua_State *L, int n) { |
| 517 | int i; | 517 | int i; |
| 518 | for (i = 2; i <= n; i++) { | 518 | for (i = 2; i <= n; i++) { |
| 519 | lua_pushvalue(L, i); /* get option (a function) */ | 519 | if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ |
| 520 | lua_pushvalue(L, -2); /* module */ | 520 | lua_pushvalue(L, i); /* get option (a function) */ |
| 521 | lua_call(L, 1, 0); | 521 | lua_pushvalue(L, -2); /* module */ |
| 522 | lua_call(L, 1, 0); | ||
| 523 | } | ||
| 522 | } | 524 | } |
| 523 | } | 525 | } |
| 524 | 526 | ||
