|
On Monday, November 19, 2001, at 07:03 PM, Peter Loveday wrote:
-- 'name' contains the name of the function I wish to create setglobal(name, function() return name.."!" end) This declaration succeeds, but unfortunately when calling the function 'name' refers to the current contents of the name variable, not the contents at declaration. Is there some way to force this to be expanded, or the reference frozen, at declaration time ?
function declare(name) local func = dostring("return function() return [["..name.."!]] end") setglobal(name, func) end Steve