| 505 | |
| 506 | |
| 507 | static void setfenv (lua_State *L) { |
| 508 | lua_Debug ar; |
| 509 | if (lua_getstack(L, 1, &ar) == 0 || |
| 510 | lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ |
| 511 | lua_iscfunction(L, -1)) |
| 512 | luaL_error(L, LUA_QL("module") " not called from a Lua function"); |
| 513 | lua_pushvalue(L, -2); |
| 514 | lua_setfenv(L, -2); |
| 515 | lua_pop(L, 1); |
| 516 | } |
| 517 | |
| 518 | |
| 519 | static void dooptions (lua_State *L, int n) { |
no test coverage detected