> So I hope there is a way to replace setfenv/getfenv easily in 5.2 Search the upvalues of the function looking for the one named _ENV. If debug info has been stripped from the function, you're out of luck, but that does not seem to be your case.