lua-users home
lua-l archive

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


... Let a function with an enviromment call another with other enviromment?
Example:
-- block
    tab = {}
    function tab.afunc()
        print("Inside tab.afunc");
    end
    setfenv(tab.afunc, tab);
-- end block

    The code above raise an error with "attempt to call global 'print' (a
nil value)". Yes, I know that the code is trying to call tab.print, but how
to set it to call the real print? (Please, I know too that I can write
tab.print = print; but this isn't what I want).

                                                                        The
God's Peace,


Leandro.