Mex
05-16-2009, 10:51 PM
yo,
here's the code i've got so far:
function blah()
local aaa = "testing"
dofile("SomeFile.txt")
end
SomeFile.txt:
outputConsole(aaa)
When lua executes 'SomeFile.txt', instead of outputting "testing" in the console, it outputs '(null)'.
After reading around I think it's because lua executes the file's content in the global enviroment, and because aaa hasn't been defined in the global enviroment, it doesn't see it.
Does anyone know how I could get it working? Ie. Lua sees the variable 'aaa' and outputs 'testing' in the console.
Thanks!
Mex
here's the code i've got so far:
function blah()
local aaa = "testing"
dofile("SomeFile.txt")
end
SomeFile.txt:
outputConsole(aaa)
When lua executes 'SomeFile.txt', instead of outputting "testing" in the console, it outputs '(null)'.
After reading around I think it's because lua executes the file's content in the global enviroment, and because aaa hasn't been defined in the global enviroment, it doesn't see it.
Does anyone know how I could get it working? Ie. Lua sees the variable 'aaa' and outputs 'testing' in the console.
Thanks!
Mex