lua-users home
lua-l archive

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


Hi,
     I have the following code snippet:
---------------------------------------------------

local function add(a,b)
return a + b
end

print(_ENV["add"],_G["add"],add)

for k,v in pairs(_ENV) do
print(k,v)
end
print("-------------------")


print(debug.getupvalue(debug.getinfo(1).func,1))
------------------------------------------------------

I am trying to find out where "add" function is stored. Since it is defined local it was not there in _ENV and _G. I also cannot find it in the upvalues. Where is the function?

Thanks,
Milind