title: How to create a custom .NET dll loadable for Lua(forWindows)?
body: <p>We are doing a project in .NET framework and want to make most of its functionalities available later for Lua scripts. I thought I could compile a dll and load it to Lua script with the help of LuaInterface. But somehow it did not work.</p>
  
  <p>What DID work is the following:</p>
  
  <pre><code>require 'luanet' 
  luanet.load_assembly("System.Windows.Forms")
  Form = luanet.import_type("System.Windows.Forms.Form")
  Button = luanet.import_type("System.Windows.Forms.Button")
  form1 = Form()
  button1 = Button()
  </code></pre>
  
  <p>As you can see, here I'm loading standard assembly and types, which didn't cause much problem.
  However, if I have my own dll 'LuaTest' compiled under .NET 4.0 and try to load it in LUA. It did not work. I wrote something like,</p>
  
  <pre><code>require 'luanet'
  luanet.load_assembly("LuaTest")
  PlanetarySystem = luanet.import_type("LuaTest.PlanetarySystem")
  solarSystem = PlanetarySystem()
  </code></pre>
  
  <p>where 'PlanetarySystem' is a class in LuaTest. If I run this piece of code, the interpreter would say: attempt to call global 'PlanetarySystem' (a nil value). </p>
  
  <p>I also tried another way to load the dll:</p>
  
  <pre><code>package.path = package.path .. ";" .. "/?.dll"
  require 'luanet'
  require 'LuaTest'
  </code></pre>
  
  <p>After run, the interpreter throws: lua: error loading module 'LuaTest' from file '.\LuaTest.dll': The specified procedure could not be found.</p>
  
  <p>I'm quite a newbie to .NET framework and LuaInterface. Perhaps I did something utterly wrong. Please help me on this. Many thanks!</p>
  
  <p>Edit: Perhaps I should have an 'Entry Point' for Lua in my dll to indicate that this dll is LUA loadable???</p>
  
  <p>Edit: Lua not LUA. No offense to Portuguese speaking people. The Lunanet I'm using must be compatible with .NET 4.0, otherwise the first piece of code would not work.</p>