lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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?