Posted 28 February 2013 - 10:29 PM
In a project I am making I need to run an separate Lua file at the same time as the current one. This is working fine using os.run(…). However, I am having a bit of trouble with the environment. I need the separate Lua file to access all the variables and functions in the main file. I could add all of the functions to the environment one by one, but there must be another way.
I've looked at _G but that doesn't seem to work.
For example, the following code list all the standard variables and functions (e.g. 'os', 'math', etc) but not 'aFunction' or 'aVariable'. What can I use to get them.
If you have a better idea on how to add all the functions to the environment please suggest it.
I've looked at _G but that doesn't seem to work.
For example, the following code list all the standard variables and functions (e.g. 'os', 'math', etc) but not 'aFunction' or 'aVariable'. What can I use to get them.
aVariable = "Hello"
function aFunction (message)
print(message)
end
for key, value in pairs(_G) do
print(key)
print(value)
end
If you have a better idea on how to add all the functions to the environment please suggest it.