[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Expanding variables at function declarion time
- From: "Peter Loveday" <peter@...>
- Date: Tue, 20 Nov 2001 13:33:18 +1030
Greetings!
I am looking for a way to expand a variable's contents when I
create a function, using setglobal().
For example, say I want to create a series of functions which
simply return their name with an exclamation mark appended to
it, for each one I might do:
-- '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 ?
Thanks for your help,
Love, Light and Peace,
- Peter Loveday
eyeon Software