© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
30 replies
toxidworm

NLua problem

I'm trying to embed lua in my application and I'm stuck over a problem that it cannot pick method names from .NET
LUA:
import ('System.Diagnostics')

Process:Start("notepad")
import ('System.Diagnostics')

Process:Start("notepad")

C#:
static void Main()
{
    Lua state = new Lua();
    state.LoadCLRPackage();
    string script = File.ReadAllText("script.lua");
    state.DoString(script);
}
static void Main()
{
    Lua state = new Lua();
    state.LoadCLRPackage();
    string script = File.ReadAllText("script.lua");
    state.DoString(script);
}


The error
Unhandled Exception: NLua.Exceptions.LuaScriptException: [string "chunk"]:3: attempt to index a nil value (global 'Process')
   at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
   at NLua.Lua.DoString(String chunk, String chunkName)
   at LuaEmbed.Program.Main() in D:\Dev\Sharp\LuaEmbed\LuaEmbed\Program.cs:line 15
Unhandled Exception: NLua.Exceptions.LuaScriptException: [string "chunk"]:3: attempt to index a nil value (global 'Process')
   at NLua.Lua.ThrowExceptionFromError(Int32 oldTop)
   at NLua.Lua.DoString(String chunk, String chunkName)
   at LuaEmbed.Program.Main() in D:\Dev\Sharp\LuaEmbed\LuaEmbed\Program.cs:line 15
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ NLua csharp hooks
C#CC# / help
4y ago
[NLua] How to call function which has <T> from lua?
C#CC# / help
3y ago
[NLua] How to provide the lua state with a dynamically accessible class
C#CC# / help
10mo ago
ProblemDetails and FluentValidation
C#CC# / help
3y ago