Welcome to our forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Forum Statistics

  • Forum Members:
  • Total Threads:
  • Total Posts: 4
There are 1 users currently browsing forums.
.Net Programming A powerful framework built by Microsoft to facilitate development in Windows platforms.

Reply
  #1  
Old 01-18-2010
New Born
 
Join Date: Jan 2010
Posts: 3
Rep Power: 0
onetwosix is on a distinguished road
C# and Lua

It is currently 1:44 AM. When I started trying to create a simple C# project that implemented Lua it was 10:30. In this time period I have read tutorials, articles, and experimented, but I don't even have a hello world program to show for all of my efforts.

I have downloaded the LuaInterface1.3 (I know, an old version but that is what the main tutorial i was reading was using) and saved it at this path: CLuaInterface\luainterface-1.3.0.

I have MSVC# 2008 Express Edition.

Here is what I have done:
  • I created a console project and called it LuaTest.
  • The first thing I did was add a reference to LuaInterface.dll.
  • I added luanet.dll, LuaInterface.dll and lua50.dll to the debug folder of the LuaTest project
  • Then in the autogenerated file Program.cs I added the using statement, "using LuaInterface;".
  • I wrote some code in main which gives me this:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using LuaInterface;

namespace LuaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Lua lua = new Lua();
            lua["num"] = 2;
            lua["str"] = "a string";

            double num = (double)lua["num"];
            string str = (string)lua["str"];

            Console.WriteLine("str:" + str + "\tnum:" + num);
            Console.ReadLine();
        }
    }
}
When I try to compile this I get the following error: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) and the line
Code:
Lua lua = new Lua();
is highlighted.

I am frustrated and tired, I really want to use lua. Please help me! What is wrong, what do I need to do?
Reply With Quote
  #2  
Old 01-19-2010
New Born
 
Join Date: Jan 2010
Posts: 3
Rep Power: 0
onetwosix is on a distinguished road
Re: C# and Lua

I guess I need to reply to this and BUMP it back up. If someone has any idea of other forums I could post this at to help me get an answer to my question pm me. Thanks.
Reply With Quote
  #3  
Old 01-20-2010
callumjones's Avatar
Powered by an API.
 
Join Date: Mar 2005
Location: Perth, Australia
Age: 19
Posts: 3,609
Rep Power: 10
callumjones has a spectacular aura aboutcallumjones has a spectacular aura about
Re: C# and Lua

Try setting the target platform to 32-bit?
Reply With Quote
  #4  
Old 4 Weeks Ago
t2tom's Avatar
Obsessed With Lua & C#
 
Join Date: Feb 2010
Location: in your computer eating ur GigaHurtz
Posts: 9
Rep Power: 0
t2tom is on a distinguished road
Re: C# and Lua

this should work
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using LuaInterface;

namespace LuaTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Program prog = new Program();
            Lua lua = new Lua();
            lua["num"] = 2;
            lua["str"] = "a string";

            double num = (double)lua["num"];
            string str = (string)lua["str"];

            Console.WriteLine("str:" + str + "\tnum:" + num);
            Console.ReadLine();
        }
    }
}
Reply With Quote


Reply

Tags
csharp, implementation, lua


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with LUA zipperipperproductions General Programming 0 06-30-2009 02:36 PM
LuaInterface Explained cpf .Net Programming 0 07-27-2008 08:28 PM
WireSim- The scriptable WireMod Emulator cpf Chit Chat and Hangout 22 06-23-2008 06:25 AM
For those interested in Lua elcucopr General Programming 1 10-07-2006 06:13 AM