title: luaL_openlib replacement for Lua 5.2
body: <p>I am adapting a library written for Lua &lt; 5.2 and got to a call I don't know the equivalent of:</p>
  
  <pre><code>luaL_openlib(L, "Polycore", polycoreLib, 0);
  </code></pre>
  
  <p>Where <code>polycoreLib</code> is a </p>
  
  <pre><code>static const struct luaL_Reg polycoreLib []
  </code></pre>
  
  <p>How can I replace the call to <code>luaL_openlib</code>?</p>
  
  <p>The lua wiki only <a href="http://lua-users.org/wiki/CompatibilityWithLuaFive" rel="noreferrer">states</a>:</p>
  
  <blockquote>
    <p>Calls such as <code>luaL_openlib(L, name, lreg, x);</code> should be carefully rewritten because a global table with the given name will be searched and possibly created.</p>
  </blockquote>