| 520 | |
| 521 | |
| 522 | static void setfenv (lua_State *L) { |
| 523 | lua_Debug ar; |
| 524 | if (lua_getstack(L, 1, &ar) == 0 || |
| 525 | lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ |
| 526 | lua_iscfunction(L, -1)) |
| 527 | luaL_error(L, LUA_QL("module") " not called from a Lua function"); |
| 528 | lua_pushvalue(L, -2); |
| 529 | lua_setfenv(L, -2); |
| 530 | lua_pop(L, 1); |
| 531 | } |
| 532 | |
| 533 | |
| 534 | static void dooptions (lua_State *L, int n) { |
no test coverage detected