[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luainterface problems
- From: Fabio Mascarenhas <mascarenhas@...>
- Date: Tue, 10 May 2005 23:03:58 -0300
On 5/10/05, Greg Fitzgerald <garious@gmail.com> wrote:
> Hi, I'm new to Lua, LuaInterface, and this email list. I'm having
> some trouble with LuaInterface and was hoping someone might be able to
> help me out.
>
> First problem:
> I can't seem to import System.String or System.Int32:
> luanet = require("luainterface")
> luanet.load_assembly("System")
> Int32 = luanet.import_type("System.Int32")
> print(Int32) => nil
System.Int32 is in mscorlib.dll. You should do
luanet.load_assembly("mscorlib"). The .NET documentation has the name
of the assembly where each type is stored.
> but all imports of objects in System.Windows.Forms and System.Drawing
> seem to work fine so far.
>
> Second problem:
> luanet = require("luainterface")
> luanet.load_assembly("System.Windows.Forms")
> Image = luanet.import_type("System.Windows.Forms.Image")
> myImage = Image.FromFile( "myImage.bmp" ) => LuaInterface
> throws an exception saying: invalid arguments to method call
I assume you mean the System.Drawing assembly and the
System.Drawing.Image type, as there is no System.Windows.Forms.Image
in the class library docs. Image.FromFile should be Image:FromFile.
All method calls, even static ones, are done with a colon (:).
> I think the problem is that lua's string is different than .NET's
> string and so luainterface isn't able to determine which overload of
> FromFile to use. To troubleshoot this, I tried to import
> System.String and convert it to that before passing it to FromFile,
> but since that import doesn't work as described above, I'm stuck.
This method is not overloaded, so Image:FromFile("myImage.bmp") should
work fine.
> Any ideas?
>
> Thanks,
> Greg
>
--
Fabio Mascarenhas