Integrate an editor of LUA scripts within a Windows Forms App

Edouard Durand 1 Reputation point


I would like to make a WinForms application where I could type and execute LUA code in a textBox that would act as the LUA editor.
I did some research already, and read this link:

private void Form1_Load(object sender, EventArgs e)
    this.fastColoredTextBox1.Language = FastColoredTextBoxNS.Language.Lua;
    this.fastColoredTextBox1.Text= "function echo(s) return s end" + "\n" +
        "return echo(\"Hello!\")";

private void toolStripButton1_Click(object sender, EventArgs e)
    dynamic lua = new DynamicLua.DynamicLua();
    var result = lua(fastColoredTextBox1.Text);

1) I would also like that there is in this textbox, some autocompletion and that it is possible to display the result with print, how to do that?

2) For example, in the example of the link, there is written in lua:
function echo (s) return s end
return echo ("Hello!")

and when you run it with the toolStripButton, it displays the Hello.
But if I put a print ("Hello"), it will show me a System.Object [], I don't understand why.

3) How to display the errors in the LUA code when we run the fastColoredTextBox1?

4) Is there another way to put an LUA editor in a Winforms application?

Any help would be very appreciated. Thanks.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
34,895 questions
{count} votes