title: How can I end a Lua thread cleanly?
body: <p>My situation is that I'm using the Lua (C) API to execute a script held in a string.
  I would like the user to be able to terminate the execution of the script (this is essential if the script contains an infinite loop), how can I do this?</p>
  
  <pre><code>lua_State *Lua = lua_open();
  char * code;
  // Initialisation code
  luaL_dostring(L, code);
  </code></pre>