Question: how can I pass a value from `a.lua` to `b.lua`?

let us say that in my `a.lua` i have this code of variable.

```
local value = "Hello WOrld!"
director:changeScene ("b")

```

my problem is that how can i pass `value` from `a.lua` to `b.lua`?

thanks in advance....

Answer: 
Assign the value to the global table (`_G`), like this:

```
_G.value = "Hello WOrld"

```

In another script, you can then do this:

```
value = _G.value

```
better than just cramming stuff into the global table is to use lua's module system the way it was intended to be used.

say you had two files, a.lua and b.lua. b.lua needs some value from a.lua. this is how you'd accomplish that:

a.lua code:

```
module("a", package.seeall)

local myVal = "My value in file a"
local SomeVal = 15

function GetSomeValue()
    return myVal
end

```

b.lua code:

```
require "a"
print(a.GetSomeValue())  -- prints 'My value in file a'
print(a.SomeVal)         -- prints 15
print(SomeVal)           -- prints nil, unless you've declared it in b.lua

```

this is MUCH cleaner than just stuffing things in the \_G table. what happens if you have 3 or 4 different scripts, and you're trying to store values that should be named the same, just in different contexts? being able to say:

```
a.Value
a.Function()

```

is not only much more clear of where you are fetching data, but is much cleaner than saying

```
_G["Value"] 

```

and hoping that that is actually the value you're hoping for. using \_G might be easier if you're working on just a simple case with just two files. but it is better to learn the best practices and use them early. using \_G would be a nightmare if you had several files working together cooperatively...