function m_installer ()
module ("m", package.seeall)
local g -- forward declare g
function f ()
print "inside f"
g () -- call g
end -- f
local function g ()
print "inside g"
end -- g
end -- module m_installer
m_installer ()
m.f () -- error: attempt to call upvalue 'g' (a nil value)
-----------
I don't quite get how g is an upvalue. It is just another variable
inside the module. I can make the problem go away by removing the
"local" from the function declaration for g, but I wanted it there
because it really is a local function, I don't even want it exported
as part of the module.
Has anyone any suggestions for how to make this work in the way I
wanted? Thanks.
- Nick Gammon