title: Setting the require search path for Lua scripts
body: <p>I'm trying to use <code>require</code> from a Lua script which I load using <code>luaL_loadstring</code>.</p>
  
  <p>Here's my code:   </p>
  
  <pre><code>lua_State *L = luaL_newstate();
  luaL_openlibs(L);
  lua_settop(L, 0);
  const char *script = "require('test.lua')";
  const int ret = luaL_loadstring(L, script);
  if (ret || lua_pcall(L, 0, LUA_MULTRET, 0))
  {
      std::cout &lt;&lt; "Error: " &lt;&lt; lua_tostring(L, -1) &lt;&lt; std::endl;
  }
  lua_close(L);
  </code></pre>
  
  <p>However, when I run the code, I get the following error.</p>
  
  <pre><code>Error: [string "require('test.lua')"]:1: module 'test.lua' not found:
  no field package.preload['test.lua']
  no file '/usr/local/share/lua/5.3/test/lua.lua'
  no file '/usr/local/share/lua/5.3/test/lua/init.lua'
  no file '/usr/local/lib/lua/5.3/test/lua.lua'
  no file '/usr/local/lib/lua/5.3/test/lua/init.lua'
  no file './test/lua.lua'
  no file './test/lua/init.lua'
  no file '/usr/local/lib/lua/5.3/test/lua.so'
  no file '/usr/local/lib/lua/5.3/loadall.so'
  no file './test/lua.so'
  no file '/usr/local/lib/lua/5.3/test.so'
  no file '/usr/local/lib/lua/5.3/loadall.so'
  no file './test.so'
  </code></pre>
  
  <p>Is it possible to set the search path for Lua scripts so I can use <code>require</code> using the relative path?</p>