lua-users home
lua-l archive

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

Hi all!

I have a question for lua-list. What I want to do is to redefine the behaviour of the standard module() function.
Problem is that this function relies on the environment in which it was called in order to create the module.

Basically, what I've done so far is:
local original_module = module

function module(modname, ...)
  local m = module(modname, ...)

  --[...] do some specific things on m

  return m

require 'myusermodule'

Then I define my module in another file "myusermodule.lua":
module 'myusermodule'
--specific things have already been done on this module
--[...] contents of my user module

I think this doesn't work because of the environment of the new module() function when it is called from 'myusermodule.lua', but I've not managed to get it to work so far with my getfenv()/setfenv() attempts.
It seems that I need your two cents ;-)

Thanks a lot,

Microsoft vous recommande de mettre à jour Internet Explorer.