I created an application that uses the Mono implementation of LuaInterface, and it works beautifully without any hitches on Linux. I can't get LuaInterface to work with the Windows version of my application at all. I've spent two solid days trying to get this to work and I feel like I'm missing something really basic.
The 'latest' LuaInterface is compiled against an earlier version of .NET and won't work with 4.0. I turned up a single link to a .dll compiled against 4.0, but the link is dead. I tried to grab the LuaInterface source and compile it against 4.0 myself, but Visual Studio 2010 failed to open the solution because the project types were not supported (or some error to that effect).
I've tried MonoLuaInterface for the Windows version; although the author says that it works on Windows it plainly does not. The error I keep running into is that no matter what I do, I can't get luanet.dll to be detected by the program. I've tried putting it into the same directory as the executable, I've tried setting LUA_PATH
and LUA_CPATH
at start up, and no matter what happens it just throws at the first mention of the luanet.dll. I can't even get the sample projects to build; they can't find luanet.dll and are just dead in the water.
I tried NLua as well, and that was just a nightmare.
So my question is: does anyone know of any other (working) implementations of Lua on .NET? I'll rewrite most of the glue code if I have to, I just need to get this working. Alternatively, can anyone point me toward some solution for the luanet.dll issue, or even an answer to the LuaInterface source issue?
I know this is a really broad question, but I'm completely lost and have absolutely no idea where to even start trying to solve this. Thanks in advance to anyone with any ideas.
Okay, I've made some progress. I tried NLua again, and remembered what its problem was. After a little bit of experimenting, here's what I found out.
The Lua scripts I use interface with the rest of the program through an imported type, called the EventManager, which is loaded at the start of the relevant script. The EventManager is a singleton, and right away I assign the instance using the code:
EVENTMANAGER = luanet.import_type("Program.EventManager")
Event = EVENTMANAGER.Instance
From that point on in the code I call the exposed methods using Event:whateverfunction(). This actually works fine if I call the code using NLua's DoString() method. The problem comes in when I try to call those methods within a coroutine on the Lua side, which is how everything is actually written. When I do this, NLua throws a NullReferenceException. Stack trace is as follows:
System.NullReferenceException at NLua.MetaFunctions.GetMethod(LuaState luaState)
at KeraLua.NativeMethods.LuaNetPCall(IntPtr luaState, Int32 nArgs, Int32 nResults, Int32 errfunc)
at KeraLua.Lua.LuaNetPCall(IntPtr luaState, Int32 nArgs, Int32 nResults, Int32 errfunc)
at NLua.LuaLib.LuaPCall(LuaState luaState, Int32 nArgs, Int32 nResults, Int32 errfunc)
at NLua.Lua.DoString(String chunk, String chunkName)
So I'm closer to figuring this out, but I still don't know where to go about fixing this.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
I dug up through my discussions on #mono, and I came across this gem.
https://github.com/cdhowie/Eluant
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With