Hi Ken,
Good questions!
> When the functions are being assigned to the Ring table:
> for Name, Fnc in pairs(Methods) do
> Ring[Name] = Fnc
> end
> are complete copies of the functions being stored in the ring
> table, or simply pointers to the already existing functions
> in the Methods table?
The pointer model is closer to the truth (the assignment is
"cheap", not "deep"), although see Rici Lake's excellent
posting to the Lua mailing list for a clearer and more accurate
way of looking at references in Lua:
http://lua-users.org/lists/lua-l/2005-09/msg00056.html
> In a similar vein, when functions are created as closures, is
> it a copy of the upvalue referred to in the external function
> that is created in the function, or simply a pointer to the
> upvalue?
Again, the pointer model is more (but not completely) accurate.
By adding a couple lines to your example, you can see that it
is A, not the value A happens to be mapped to, that is captured
by Fnc as an upvalue.
local A = 10
local function Fnc(B)
return A + B
end
print(Fnc(5)) --> 15
A = 20
print(Fnc(5)) --> 25
All the best,
Kurt