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
4
votes
1 answer

How to pass a table to lua with c#

How to pass a table to lua with c# I'm using the LuaInterface,this is my c# code using System; using System.IO; using System.Text; using LuaInterface; namespace GetLuaTable { class Program { static void…
Xinbs
  • 43
  • 1
  • 3
3
votes
2 answers

Lua Nested Require Path

I'm writing a tool to parse lua plugins created by other users. The only guarentee about the plugin is that it has a data.lua file in a known directory. Inside there users are free to do anything they wish. This particular plugin using require to…
Ryan Badour
  • 584
  • 3
  • 14
3
votes
1 answer

how to register a C# class constructor in Lua

I'm using a c# class: public class TestClass { int _a; public void Set(int a) { _a = a; } public void Print() { Console.WriteLine(_a); } } and register it: Lua…
infernalcucumber
  • 103
  • 1
  • 12
3
votes
1 answer

Using NLua, how does the "require" keyword work

I have a some Lua code that contains my business logic, which I would like to run inside .NET using NLua. Some of my lua file currently use the "require" keyword in order to reference functions in other files. Now, this works fine if I run the code…
Kristian Vinther
  • 578
  • 2
  • 6
  • 15
2
votes
1 answer

NLua in C# Registering and Using a function that has a List object as a parameter

I am currently using NLua in some C# code for some front-end work. I have had no issues at all using/registering non-objects with NLua but the moment I want to use a List as a parameter in a method; it does not seem to work. This is what I have…
KangarooRIOT
  • 691
  • 1
  • 7
  • 25
2
votes
0 answers

can I use static classes in Nlua?

First and formost, I am not a native english speaker, sorry for any communication errors this question might emit. Also, couldn't really understand some of your guidelines for asking a question, so followed what I understood of it. As a consequence,…
darkmaster
  • 21
  • 2
2
votes
2 answers

How to pass and iterate a list of objects from C# to NLua

how should I pass and iterate a list of objects from C# to Lua? My example with an array of int, when I use custom classes I get the same result: state_ = new Lua(); state_.LoadCLRPackage(); var candidates = new int[] { 0, 1, 2, 3, 4, 5…
Michele mpp Marostica
  • 2,445
  • 4
  • 29
  • 45
2
votes
1 answer

ZeroBrane - Debugging with NLua & Visual Studio (for macOS)

Is there a way of debugging Lua scripts using ZeroBraneStudio but having the scripts loaded/initialized via NLua in C# from Visual Studio for macOS or even Windows (Not VS Code)? The primary reason to do so is to get the CLR package interoperability…
G.T.D.
  • 386
  • 1
  • 5
  • 21
2
votes
1 answer

NLua nuget package restore failed in VS 2017

I am trying to create a .NET 4.6.1 Class Library an use this nuget package with it: https://www.nuget.org/packages/NLua/ When I click install I get this message: Package restore failed. Rolling back package changes for 'ClassLibrary1'. If I try the…
Matt W
  • 11,753
  • 25
  • 118
  • 215
2
votes
2 answers

Cyrillic string value in lua script with c#

I try to add lua-scripts in C# project with NLua library (nlua.org). My problem is incorrect representation of Cyrillic symbols in string values. My c# code is: Lua lua = new Lua(); lua.DoFile("script.lua"); Console.WriteLine(lua["var"]); The…
dmitry1204
  • 21
  • 4
2
votes
1 answer

C# NLua: Accessing generic parameters

I have an Entity component system using generic parameters. I am trying to get Lua scripting to work using NLua. However I do not know how to access a generic parameter from the Lua environment. Something like this?: if e:HasComponent()…
Minijack
  • 726
  • 7
  • 23
2
votes
2 answers

Instance of C# class with NLua

I'm trying to create an instance of a C# class within a lua file Using NLua Here's my code. class Program { public static void Main (string[] args) { Lua lua = new Lua(); lua.LoadCLRPackage(); lua.DoString(@" …
Dusty
  • 413
  • 6
  • 17
2
votes
0 answers

Can't fully collect garbage in Lua when it's embedded into C#

I'm using NLua to compile lua code from C#. The problem is that LuaTables created in C# can't be fully disposed by Lua garbage collector. Here is the sample code: public static List TempTables = new List(); static…
Vyzhlakov
  • 21
  • 1
2
votes
1 answer

NLua (LuaInterface) - Calling a function

How is it possible to call a function when running a lua script using NLua (A LuaInterface fork)? For example, right now I have: lua.LoadFile("C:\\test.lua") lua.Call(); However, that just runs the script. Inside the script I have a custom…
user3865229
  • 125
  • 2
  • 9
2
votes
1 answer

Get list of Functions from NLua

I am using NLua for script interface with my application if my application takes multiple files such as one.lua and two.lua i want to get all the functions in all files in to a list of luafunctions List Functions; NLua doesnt seem to…
1
2 3 4 5