title: How to share data between two Lua scripts
body: <p>I'm not even sure if my plan for doing things is the best way, so I apologize if this post is a bit vague. Also, I understand that similar questions have been asked before. However, I haven't been able to find anything that pertained to my situation and that made sense to me.</p>
  
  <p>So me and my friends from school are building arcade machine, and I'm planning on putting together the main GUI that allows the user to select different games and load them if they have enough tokens. However, these separate windows will have to share some variables, mainly the number of tokens in the machine. I figured a separate Lua program could store such variable, and also have requests sent to it to perform other functions like opening and closing the different windows. Also, in case it's important to note, we will be using the Love2D engine for the games and be running all this on a Linux machine.</p>
  
  <p>By what I've read, there seems to be some C and C++ code involved in this. I know next to nothing about C or C++, and we're trying to get this project moving along, so if you could include some code in your answer and instruct me on how to use it, that'd would be amazing. I can come back later and learn some C or C++, but right now Lua is my top priority.</p>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is there a better way to accomplish what I'm trying to do?</li>
  <li>How should I go about doing this?</li>
  <li>Can this be done solely with Lua, or is some C, C++, or any other external programming language/utility/etc. required?</li>
  </ol>
  
  <p>Also, incase anyone brings it up, I have tried using global variables, but I couldn't seem to get two programs/scripts to use the same variable at once.</p>
  
  <p>Again, sorry if I'm being a bit vague.</p>
  
  <p>Thanks in advance!</p>