Page 1 of 1
Lua vs C#
Posted: Tue Jan 17, 2017 4:28 pm
by Hyrad
Hello, I don't know much about lua but I am proficient with C# and object oriented programming. I see that you have extended support for Lua. Would there be any specific advantages to using it that would justify the extra time investment to learn the language vs working with C sharp?
Thanks,
-Jeff
Re: Lua vs C#
Posted: Tue Jan 17, 2017 7:58 pm
by Tony Li
Hi Jeff,
Nope. Just use C#.
Some background info: The Dialogue System borrows its design from a professional dialogue authoring program called
Chat Mapper. In fact, you can seamlessly import and export back and forth between the two, which a lot of studios do. Anyway, Chat Mapper uses Lua, which is one of the reasons why the Dialogue System has to. But Lua is also a language that a lot of modders are already familiar with, and the Dialogue System supports importing content at runtime, such as mods. (As a side note, since Lua is designed for modders, it's a much, much simpler language to learn than C#.)
When you're writing conversations, each dialogue entry node has a Script field and a Conditions field. These use Lua. Most people use the point-and-click Lua wizards (the "..." button) to automatically generate whatever Lua code they want to include in these fields, such as checking or setting a quest state.
However, it's quite easy to
register your own C# code as a Lua function. Then just use that Lua function name in the Script or Conditions field to run your C# code. (This is what the third party integrations do.)
Re: Lua vs C#
Posted: Wed Jan 18, 2017 8:41 pm
by Hyrad
Thanks Tony for taking the time to explain, it puts things into perspective. I will be registering my own C# code as Lua functions, as per the manual link you provided

Re: Lua vs C#
Posted: Wed Jan 18, 2017 8:54 pm
by Tony Li
Sounds good!