title: Erlang - Global Variables .. yes I know, I know
body: <p>Ok I have been trying every which way to figure this out.</p>
  
  <p>I need to get this table to be a global.. I have realized it is much less efficient to pass TableID around.. in the scope of my program.</p>
  
  <p>So I tried creating a new table then looking it up:</p>
  
  <pre><code>TableID = ets:new(tb, [set,public]),
  put({tableUniqueID}, TableID),
  </code></pre>
  
  <p>Then I used:</p>
  
  <pre><code>get({tableUniqueID})
  </code></pre>
  
  <p>And in the same function it returns TableID just fine... yet when I use it in another function, it returns an undefined.</p>
  
  <p>What?? I thought get and put made a key global..</p>
  
  <p>ALSO before all this I realized you "could" call a table lookup function as such:</p>
  
  <pre><code>ets:lookup(get({tableUniqueID}), msgIn)
  </code></pre>
  
  <p>Same thing, in function works, outside does not.. Get Put problem..</p>
  
  <p>Then I realized another way to Lookup a table would be by calling the atom of the table</p>
  
  <pre><code>ets:lookup(tb, msgIn)
  </code></pre>
  
  <p>But this NEVER works, not inside the function, not out..</p>
  
  <p>So my main priority would be to figure why looking up a table by its atom, is not possible.  But it says it is most everywhere, including the manual.</p>
  
  <p>The get/put I could live without,  As long as I can store table, then lookup the table by its atom identifier.</p>
  
  <p>Can anyone shed light on this dilemma?</p>