lua-users home
lua-l archive

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


Hi Romulo Bahiense, Luiz, Gerald,  Julien,

It worked :-). Thanks a lot for your all help.

Regards,

Krish



Romulo Bahiense wrote:

Oops, one mistake:

configloader2.lua
function load( filename )
    local f = assert( loadfile( filename ) )

    local t = {}
    local old_DEF_PARAM = DEF_PARAM

    local e = setmetatable(
        {
            DEF_PARAM = function( info )
                -- In case DEF_PARAM creates another table...
                info = old_DEF_PARAM( info )
                t[ info ] = true
                return info
            end;
        }, {
            __index = _G;
            __newindex = function( self, k, v )
                if t[ v ] then
                    v.NAME = k
                end
            end;
        }
    )
    setfenv( f, e )
    f()
end

~~ end of configloader2.lua


I was also using a 't' as the name of 'self' on '__newindex'. Sorry.
--rb