Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

What is the best LUA interpreter for Unity ?

Discussion in 'Scripting' started by Chusek, Mar 14, 2016.

  1. Chusek

    Chusek

    Joined:
    Oct 9, 2012
    Posts:
    7
    I'd like to add some modding capability to my resource management game.

    I have different game variables each with different formulas.

    ie.

    foodHappiness = foodProduction / foodConsumption ;
    foodVariety = meatCount / fruitCount;

    I don't want to hardcode these formulas in C#. And I also want modders to be able to add their own variables.

    Did some research and I suppose using LUA interpreter or whatever it's called is the way to go.

    But which one is the best solution I discovered the following :

    NLua

    UniLua

    MoonSharp : Latest update Feb 9, 2016

    LuaInterface : Looks old

    I tried MoonSharp but I didn't understand how to access C# stuff from Lua string code.

    I tried NLua I got it working. It does something like load C# Library and I can access C# stuff.

    But I believe NLua is causing Unity to sometimes crash when I press play.

    Not sure if this is the right place to post sorry in advance if it's not.
     
  2. EliasMasche

    EliasMasche

    Joined:
    Jul 11, 2014
    Posts:
    92
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,840
    Are you sure a Lua interpreter is the way to go? I was pretty smitten with Lua at first — even started writing a book about Lua development (in the Codea environment) for kids — but the deeper I got into it, the more it annoyed me. I'm afraid that romance turned sour rather quickly.

    So I ended up developing MiniScript instead. See the discussion thread here, or try the demo. I believe the code is quite solid; I'm mostly working on fleshing out the docs before I submit it to the Asset Store, where it will be a paid asset. However, if you want to incorporate it into your game now, you can have it free as an early adopter (plus getting lots of personal support!). Just PM me if you're interested.
     
    Nigey likes this.
  4. Chusek

    Chusek

    Joined:
    Oct 9, 2012
    Posts:
    7
    well, I've scorched google for days (I skipped this and work on other features in the mean time) and found LUA. I'm so new at this I don't even know what this sort of functionality is called - what I'm supposed to google.

    So, sure I'll try !
     
  5. topameng

    topameng

    Joined:
    Feb 18, 2014
    Posts:
    3