GameCTO / luainterface

Automatically exported from code.google.com/p/luainterface
0 stars 0 forks source link

Unable to expose classes as dll to Lua #55

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a class as follows and compile in .NET4.0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LuaInterface;

namespace LuaTest
{
    public class Planet
    {
        public Planet(string name)
        {
            this.Name = name;
        }
        public Planet() : this("NoName") { }
        public string Name
        {
            get;
            private set;
        }

        public void printName()
        {
            Console.WriteLine("This planets name is {0}", Name);
        }
    }
}
2. Put the dll in the same folder as where my Lua script is.
3. In Lua write something like this:
require 'luanet'
luanet.load_assembly 'LuaTest'
Planet = luanet.import_type 'LuaTest.Planet'
local p = Planet()

What is the expected output? What do you see instead?
Error: attempt to call global 'Planet' (a nil value). My assembly is not loaded 
at all, it seems.

What version of the product are you using? On what operating system?
The LuaInterface.dll and associated Lua51.dll were rebuilt in .NET4.0. I'm 
using windows 7 64-bit system and VC 2010. 

Please provide any additional information below.

I even tried registering my dll to GAC....Still have the same problem.

Original issue reported on code.google.com by squall...@gmail.com on 19 Nov 2012 at 3:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I tried loading a standard C# assembly, such System.Console. It worked. But 
never with my own dll.

Original comment by squall...@gmail.com on 19 Nov 2012 at 3:25