Web Design and Web Development Forum

  1. #1
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0
  2. onetwosix is on a distinguished road
  3. 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: C:\LuaInterface\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 Reply With Quote
  4. #2
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0
  5. onetwosix is on a distinguished road
  6. 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 Reply With Quote
  7. #3
    callumjones's Avatar
    Join Date
    Mar 2005
    Location
    Perth, Australia
    Age
    21
    Posts
    3,335
    Rep Power
    12
  8. callumjones has a spectacular aura about callumjones has a spectacular aura about
  9. Re: C# and Lua

    Try setting the target platform to 32-bit?
    Reply With Quote Reply With Quote
  10. #4
    t2tom's Avatar
    Join Date
    Feb 2010
    Location
    in your computer eating ur GigaHurtz
    Posts
    13
    Rep Power
    0
  11. t2tom is on a distinguished road
  12. 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();
            }
        }
    }
    :D
    Reply With Quote Reply With Quote

Similar Threads

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