[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require in another enviroment
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 26 Dec 2012 15:11:42 +0200
On Wed, Dec 26, 2012 at 3:01 PM, Victor Bombi <sonoro@telefonica.net> wrote:
> This is exactly what I did (before using the needed require)
If I do exactly that, then I get what I expect:
synth = [[
variable = 20
]]
blabla = [[
var2 = variable*2
]]
env = {}
chunk = loadstring(synth)
setfenv(chunk,env)
chunk()
print(env.variable)
chunk = loadstring(blabla)
setfenv(chunk,env)
chunk()
print(env.var2)
output is
10
20
steve d.