Re: Fwd: How to forward declare globals
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Fwd: How to forward declare globals
- From: Enrico Colombini <erix@...>
- Date: 2014年10月06日 14:37:39 +0200
On 06/10/2014 14.15, Charles Smith wrote:
Okay, I got it to work:
v = "m1"
function m1 ()
print ("hello world")
end
_G[v]()
If I understand correctly what you would like to achieve:
------------------
function Init()
v = m1
end
function m1()
print ("hello world")
end
Init()
------------------
This way, m1 is already defined when its value is used, because Init()
is called after all chunk-level (global) assignments, such as "function
m1" have been executed.
--
Enrico