Questions tagged [nlua]

NLua is the bind between Lua world and the .NET world.

NLua provides the 'glue' that allows the usage of Lua from C# and other .NET languages. It supports Windows, Linux, Mac, iOS , Android, Windows Phone 7 and 8.

Project repository on Github.

64 questions
2
votes
2 answers

Return directly to caller of caller and restore state on next call

I'm building a plugin to a system. My plugin's update() method is called occasionally by the system. In my plugin's update() method, I'm modifying the systems state, however the system state isn't updated until the system has had a chance to do so…
Skeen
  • 4,614
  • 5
  • 41
  • 67
1
vote
0 answers

Bad binary format when loading Lua bytecode

Using C# and NLua, I am trying to convert Lua functions into bytecode so that I can store it and execute it later. I've written a small test shown below to see if I could get the basic dump and loading to work, and it seems the conversion to…
Blavius
  • 111
  • 3
1
vote
1 answer

Can I create an NLua.LuaFunction without the name of the Lua function?

I am trying to make a method that evaluates a string and returns a LuaFunction object for the function contained in it. These strings will be input by a user so I can't know the names of the functions beforehand. Example string: function…
VeryGoodDog
  • 335
  • 2
  • 11
1
vote
0 answers

I am unable to use Nuget Nlua to read .lua file in C#

Using visual studio with class application I added the NLua via NuGet. I want to read in and .lua file (BTW, of there is a better way do let me know) My code is this: ... using NLua; ... using (Lua lua = new Lua())... But when I run it I get an…
dandan
  • 509
  • 3
  • 8
  • 21
1
vote
1 answer

Terminate NLua script execution

I'm using NLua to run Lua script in my app. I need to implement ability to terminate script that runs in separate thread at any time, for example user press "Stop" button and script must terminate immediately. I've read about SetDebugHook and tried…
1
vote
1 answer

What exactly is setmetatable, and how do I avoid it for security reasons?

Generally sandboxes block setmetatable like shown here: local function memoize(f) local mt = {} local t = setmetatable({}, mt) function mt:__index(k) local v = f(k) t[k] = v return v end return t end The question is, I want…
Valleriani
  • 193
  • 11
1
vote
0 answers

How I can get function local variables under debugging script in NLua?

When I debug lua-script, using NLua, and when I reach DoSomething() function call (line with return statement), how I can get list of function local variables (int1, int2, int3 and str1), and get their values? Is there possible, or I can see only…
slavka
  • 119
  • 6
1
vote
0 answers

Deserialize Lua table with NLua

I have searched the web and particularly this: Table Serialiazation and none of them work. I am trying the simplest of tables as follows: THIS IS THE INPUT.LUA FILE { ["customers"] = { ["name"] = "John Smith", ["age"] = 45 …
MatthewR
  • 11
  • 1
1
vote
1 answer

Lua: dynamic libraries not enabled. How do I enable them?

I'm getting an error in Lua saying NLua.Exceptions.LuaScriptException: error loading module 'socket.core' from file '.\socket\core.dll': dynamic libraries not enabled; check your Lua installation the line throwing this error is the 1st…
ZMarotrix
  • 11
  • 2
1
vote
0 answers

How to specify the startup project path in post-build events

I have a NuGet package which I add to a class library. The package adds an xcopy command to the post-build events of the class library. The xcopy copies a dll from the packages folder to the $(TargetDir) which, of course, is the bin folder of the…
Matt W
  • 11,753
  • 25
  • 118
  • 215
1
vote
1 answer

Unable to load DLL 'lua52': The specified module could not be found

I have the same problem as described here: https://github.com/NLua/NLua/issues/33 Though I have followed the instructions to create a console application... http://www.screencast.com/t/M12TqePQxW ...which works just fine, when I create a library…
Matt W
  • 11,753
  • 25
  • 118
  • 215
1
vote
1 answer

How do I perform a bitwise OR on .NET enums in script running with NLua?

I have the following reflection code in C# which I'm trying to replicate using NLua script: G.Object.GetType().GetField("count", BindingFlags.Instance | BindingFlags.NonPublic); Everything is fine, until I try to use Bitwise OR operation on two…
user3110577
1
vote
0 answers

Can not handle NLua crash

I'm trying to use lua scripts on my C# application, but I'm having problems to run different scripts, when I run 3~4 scripts I keep getting this exception: As you can see I'm "catching" the AccessViolationException exception, just in…
Kyore
  • 388
  • 2
  • 7
  • 29
1
vote
1 answer

Building NLua from source (Windows): Lua52.dll?

I'm struggling with building NLua from source on Windows. It requires a modified Lua version, otherwise my code fails with a missing "lua52.dll". https://github.com/NLua/NLua/issues/53 I tried to get it from here https://github.com/NLua/lua then…
xc6lx45
  • 25
  • 3
1
vote
1 answer

NLua handling C# Exceptions

I'm looking at NLua for scripting of an existing C# application, where C# functions called from lua may throw exceptions. So far, I found this: If the lua code does not handle an exception in a called C# function, NLua wraps and re-throws it so it…
xc6lx45
  • 25
  • 3