Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while trying to connect WebClient to Lua #513

Open
corruptedbyte opened this issue Dec 26, 2023 · 1 comment
Open

Error while trying to connect WebClient to Lua #513

corruptedbyte opened this issue Dec 26, 2023 · 1 comment

Comments

@corruptedbyte
Copy link

corruptedbyte commented Dec 26, 2023

using NLua;
using System;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using System.Linq;
using System.Text;

namespace Asbestos
{
    internal class Program
    {
        static void Main()
        {
            Lua state = new Lua();
            state.State.Encoding = Encoding.UTF8;
            state.LoadCLRPackage();
            state.DoString(File.ReadAllText("script.lua"));
        }
    }
}

Lua

import('System.Net')

client = WebClient()

The error:

Unhandled Exception: NLua.Exceptions.LuaScriptException: [string "chunk"]:3: attempt to call a nil value (global 'WebClient')
   at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
   at NLua.Lua.DoString(String chunk, String chunkName)
   at Asbestos.Program.Main() in D:\Dev\Sharp\Asbestos\Asbestos\Program.cs:line 17
@viniciusjarina
Copy link
Member

It works from C# side? Aren't you missing a Reference ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants