lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.