title: How to share global variables between Lua scripts
body: <p>I would like to know how to share global variables between Lua scripts.</p>
  
  <p>I tried to do this myself using <code>require</code> but it doesn't work as I expected.</p>
  
  <p>Here's my simple example code.</p>
  
  <p>In <code>test.lua</code></p>
  
  <pre><code>num = 2
  </code></pre>
  
  <p>In <code>A.lua</code></p>
  
  <pre><code>require(`test`);
  num = 5
  </code></pre>
  
  <p>In <code>B.lua</code></p>
  
  <pre><code>require(`test`);
  print(num);
  </code></pre>
  
  <p>And if I run <code>A.lua</code> first, then <code>B.lua</code>, I get the following result:</p>
  
  <pre><code>2
  </code></pre>
  
  <p>But I expect to get <code>5</code> because I modified the variable value to <code>2</code> in <code>A.lua</code>.</p>
  
  <p>Is it possible to achieve what I want? (I would appreciate an example)</p>