lua-users home
lua-l archive

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


Given the code:

f = function ()
        local o = 10
        return
                function(x) return x+o end
end

local o = 10
g = function ()
        return
                function(x) return x+o end
end

print(f(),f(),g(),g())

It prints:

function: 0x2196ff0    function: 0x21965f0    function: 0x2196da0    function: 0x2196da0

The problem:  Why f() returns different functions while g() does not?



--
Rodrigo Azevedo Moreira da Silva