[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: is setfenv useless?
- From: "mr. Aleph" <mraleph@...>
- Date: Sun, 05 Mar 2006 21:15:05 +0600
Hi,
I last night was hacking through Xavante and trying to make
it work with lua 5.1. And suddenly I thought: "What a strange
code!"
----------------------------------------
-- a strange code from venv.lua
-- skipped code does smth equivalent to
-- ng = {}
-- ng.require = _G.require
setfenv(ng.require, env)
----------------------------------------
I think this is probably a bug in venv. This code is trying to
change fenv of the global require.
So I think:
While there are no possibility to clone functions, setfenv
(debug.setfenv) remains almost useless.
Am I correct?
--mraleph