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
1
vote
1 answer

Syntax to call generic C# method from NLua

I'm having some trouble figuring out the correct syntax for calling a generic C# function from Lua with NLua. I'm trying to call the following C# XNA function from Lua GameWorld.Instance.Content.Load("player"); But I'm having some syntax…
1
vote
1 answer

Passing 'chinese' string to NLua

I have C# code calling a lua function. I'm passing string to this function. This function processes the string and returns another string in a table. When I try to pass 'chinese' string "怎么说" - I get "???" in lua. (I tried to print and save this…
1
vote
1 answer

How to use C# static string with Nlua

I am using NLua for script interface with my application. I want to send keyboard input from LUA language to my C# code. I do with this C# code. using (Lua lua = new Lua()) { lua.LoadCLRPackage(); lua.RegisterFunction("keypressC",…
LeMoussel
  • 5,290
  • 12
  • 69
  • 122
1
vote
1 answer

Is it possible to use LINQ with NLua?

I am wondering if it is possible to use LINQ with NLua? I have searched various sources including the project's github page, but without any luck. I got the following minimal C# example: using (var lua = new Lua()) { lua.LoadCLRPackage(); …
Lasse Christiansen
  • 10,205
  • 7
  • 50
  • 79
0
votes
0 answers

Nlua:How to release the C# class instantiated in the Lua script?

The Lua script is over, but the C# class instantiated in the lua script has not been released, it is still running, how do I release the corresponding resources? I want to call C# resources through Lua scripts, and when Lua scripts stop, release all…
ambit
  • 1
0
votes
1 answer

How to pass table arguments from NLUA function to C# method?

I'm using NLUA in a C# project. I use the following code to register a C# method to be availabel in LUA (NLUA) environemnt (and works): // C# code to register the methoin LUA environment: Lua state = new Lua(); state["MyLog"] = new LuaLog(); // C#…
Alessandro
  • 11
  • 2
0
votes
1 answer

How do I invoke a C# delegate from Lua where the delegate can throw an exception

Running the following code in a Linux based docker image causes the CLR to crash. static void Main(string[] args) { System.Console.WriteLine("Starting program"); using (NLua.Lua luaState = new NLua.Lua()) { …
Taemyr
  • 3,407
  • 16
  • 26
0
votes
0 answers

Getting a Lua Script Error called: Unknown Lua Script Error

My Lua script works fine for me, but some people are having issues with it. They keep getting this error: NLua.Exceptions.LuaScriptException: Unknown Lua Error Looking at my script it's this part right here that gives the error: while true…
0
votes
1 answer

LUA 5.2: Load/Require/etc - Limit it to specific directories that can be loaded

I am attempting to secure LUA on my game (players can create scripts in LUA). I've removed many functions to create a sandbox of sorts, (AKA removing os.execute function for example.) however, my game does use loading of scripts from other locations…
Valleriani
  • 193
  • 11
0
votes
1 answer

Rasa calling external API throws NONE

I built a small chat bot using rasa. I want my bot to tell a joke by calling an external api but i'm getting None as the response. I'm attaching the API call method here. class ApiAction(Action): def name(self): return…
Sai Prasanth
  • 73
  • 1
  • 13
0
votes
0 answers

How to run an executable from lua?

I am trying to start an executable by lua. Lua function is called in a thread by c#. os.execute starts a .bat file, which is kept at the same location as the program but not able to start the…
Amit Kumar
  • 620
  • 4
  • 17
0
votes
1 answer

How do i add and use NLua within my vs solution?

I am trying to create a database written in Lua that is separate from my methods that are written in c#. The answer I have found so far on how I can run Lua from c# has been "NLua" ( https://github.com/NLua/NLua ) but I have no idea where to start…
DED
  • 391
  • 2
  • 12
0
votes
0 answers

NLUA bad image exception in x64 .Net core

I use NLUA dll in my visual studio 2017 on windows 10 , I am using .Net core 2.1 x64 to build and publish my ASP.Net core Application . Bad Image exception 'bad image KeraLua.NativeMethods.LuaLNewState()' is recieved when i try to do MyLua =…
0
votes
1 answer

Calling external assembly

i am referring to "SomeClass" on the NLua home page. Let#s assume that this has been compiled into assembly "SomeClass". When i want to use it in Lua, i should be abler to refer to it using: import ('SomeClass', 'SomeClass') myclass=SomeClass() …
Helmut
  • 105
  • 1
  • 9
0
votes
1 answer

NLua - How to add new functions to a userdata through Lua?

I'm trying to define a new function for my Player class which was defined in C#. The purpose of Lua in my project (a game engine) is to define custom behavior for entities such as players. However, when I do DoFile(fileName) on the Lua file, it…
tayoung
  • 411
  • 1
  • 4
  • 16