Giter Site home page Giter Site logo

nlua / nlua Goto Github PK

View Code? Open in Web Editor NEW
2.0K 88.0 298.0 88.24 MB

Bridge between Lua and the .NET.

Home Page: http://nlua.org

License: MIT License

C# 85.68% PowerShell 1.87% Lua 12.45%
luainterface lua-functions c-sharp dotnet xamarin netcore netstandard lua

nlua's People

Contributors

avetome avatar ayrton97 avatar caioavidal avatar cdhowie avatar charlenni avatar dcronqvist avatar devops-codefoco avatar dpull avatar gportela85 avatar halex2005 avatar hamish-milne avatar ifdog avatar isaacbrodsky avatar joelcreatesgames avatar kagamia avatar luttje avatar mathyn avatar maxvain avatar megapiggy avatar megax avatar mervill avatar michaelsenko avatar mikeschurman avatar neo-vortex avatar prabirshrestha avatar robertoiffland avatar tznind avatar vanillasixtysix avatar viniciusjarina avatar vontio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nlua's Issues

Support lua_newstate() in addition to luaL_newstate(), with caller-provided allocator

When building a sandboxed Lua environment, it's important to be able to constrain the memory consumption of the environment. Currently, NLua does not provide any facility by which this can be implemented.

It would be nice if the Lua constructor would accept a delegate matching lua_Alloc and then call lua_newstate(), passing in this function. This would allow a sandboxing environment all of the flexibility that comes with a custom memory allocator, including implementing memory constraints as well as custom allocation strategies.

The proposed delegate type would be something like:

public delegate IntPtr LuaAllocator(object userData, IntPtr ptr, UIntPtr oldSize, UIntPtr newSize);

The sizes are UIntPtr, as size_t will vary on 32/64 bit systems.

The proposed Lua constructor would be:

public Lua(LuaAllocator allocator, object userData);

The Lua object would of course have to retain references to both parameters so that the object and allocator are not prematurely collected.

README.md incorrect

Hey,

I was looking at getting the WP8 version, but I noticed all the links (From Android and below) are incorrect.

Could you let me know where I can get the WP8 version from?

Regards

How to expose application classes to NLua?

I'm trying to follow the design in NLuaSample to expose a Scriptable class in my application to my Lua code. I've created the class with:

namespace NLuaSample
{
    public class Scriptable : IDisposable
    {
        ...
    }
}

And I try to use it in Lua with

import 'NLuaSample'
local s = Scriptable ("My String Parameter")
s:DoSomething ()

However, this gives the error

attempt to call global 'Scriptable' (a nil value)

I've made sure that the class isn't stripped by the linker by explicitly creating objects and calling DoSomething() in my C# code.

What am I doing wrong?

Note, that I am able to use classes from the CLR, i.e.:

import 'System.Windows.Forms'
MessageBox.Show("Not implemented!")

Just not classes in my own code.

[Request] Unity Assistance

Hello I was wondering if it would be possible to use this with the Unity Engine.

I've tried a few attempts myself to no avail, however I can get this working in a standard c# project.

If anyone has managed to get this working I would appreciate some assistance.

Also is there a way to redirect the print function to another function other than Console.Write/Writeline?
( Without overwriting the default function. )

I will add this information to the Wiki to help others if I figure it out!

...arg is nil

I create a print function with ... arg,but arg variable is nil
__print__ is my binding function.

function print (...)
    __print__(arg)
    local printResult = ''
    for i,v in ipairs(arg) do
        printResult = printResult .. tostring(v) .. '\t'
    end
    __print__(printResult .. '\n')
end

print('hello','world')

arg is null

Build system cannot target KopiLua, nor a Linux build of KopiLua

The top-level build system cannot switch NLua to use KopiLua since there is no configuration in the NLua project that sets the appropriate compile-time define.

Similarly, KopiLua cannot be built for Linux without removing _WIN32 from the list of defines in the project file.

Ideally,

  1. There should be a way to target KopiLua at the the toplevel with a switch similar to ./configure --enable-kopi.
  2. There should be a way to specify a Linux build of KopiLua, or (even better) detect the platform at runtime and switch logic instead of resorting to #if _WIN32.

These are both blockers for using this project in a Linux implementation. Due to the number of nested submodules, it is infeasible to fork the project to fix this as that requires forking all of the submodule repositories and then updating all of the submodule references to use the forks. This is a lot of work that will only create more work down the road if NLua's submodule references change.

My only option here is to have this fixed upstream, or distribute a patch file that can be applied against NLua to bring it into a state suitable to be built on Linux.

NLua Bug after merge

Hi

In NLua a bug was created after this commit: https://github.com/Schumix/NLua/commit/ea33713d819a9a2a682906f29d9fd13570ed67a7�
I always does merging after x time, and with the current( i waited because there were a lot of changes and wasnt finished in all files) a problem eruded. it starts with the commit above.
The problem is the following: ...egax/Asztal/Schumix2/Run/Release/Scripts/Lua/sys.lua:14: A .NET exception occured in user-code�
There is a function which registers the function in my system. But up till now it was fine. If you need more description about the error, please give intructions about what should i do.

ps.: The NLua was translated with Kopulau.

@megax

support for com objects

I have been creating a VS plugin using NLua, but need to access com objects from Visual Studio (EnvDTE stuffs).

Would be aweseome if dot operators could just work like normal lua code for com objects too. In .NET4 dynamic does solve this problem too.

DTE.ExecuteCommand("File.SaveAll");

NLua & LuaLanes: Has anybody achieved this?

Has anyone successfully ran LuaLanes under NLua / .NET integration?
With my build of lanes, NLua is throwing an unhandled AccessViolationException on require 'lanes'.
Would be great to get this working.

unicode

is Nlua support unicode string?

How to integrate with 32-bit project

Now that issue #63 is resolved, I can create a simple console application, add the NLua NuGet package, change the platform target to x64 and compile it. Yay!

The problem I'm having now is with my real application, with is a 32-bit XNA project. The XNA libraries are 32-bit only, so I don't have the option to change the platform target. Trying to run my program after adding the package (and the line var lua = new Lua()) throws an exception:

BadImageFormatException: An attempt was made to load a program with an incorrect format.

The code is here if you want to see it: https://github.com/davidkennedy85/RpgTown/tree/385d70e885d7a30c9e67a7c37489ef4203f2840d

What is the correct way to round trip binary data from Lua to C#?

If I have binary data (say a .png file) in a Lua string and what to get that data as a byte[] in C#, what is the correct way?

On my machine, this worked, but it didn't work on a different machine with russian locale:

Encoding.GetEncoding(1252).GetBytes(s)

This seems to work consistently on the machines where I've tried it:

Encoding.Default.GetBytes(s)

But it feels brittle. What if the Lua string is not a valid encoding of anything in the default encoding. Do I have to base-64 encode my binary data?

can not load_assembly System.Drawing

When i use "luanet.load_assembly "System.Drawing";", then get the error.
the error info is:
A .NET exception occured in user-code

I try to load_assembly something else lick System, System.IO, System.Winodws...etc., It' all find.Only the load_assembly "System.Drawing" will get that error.

Readme contains multiple issues

For example:

NLua is a fork of project NLua (from Fábio Mascarenhas/Craig Presti).

I'm pretty sure you meant to say "NLua is a fork of project LuaInterface". Since it's not a fork of itself.

There are also no instructions explaining exactly what you're supposed to do with the downloaded files. I see 3 DLLs there. OK, so... what do I do with them? Am I supposed to overwrite my existing lua5.2.dll with yours? Is that necessary? Do I need to have a Lua 5.2.2 executable to use the command-line build? What am I supposed to require in my Lua script to be able to use them?

It's good to see a GitHub project that has real downloadable files. But it would be better if it were clear how to use them.

registering varargs function

how do i register a .net function that accepts variable args from lua and returns multiple values.

tried this but doesn't work.

c# code

public object[] Method(params object[] parameters) {
}

lua.RegisterFunction("method", this, GetType().GetMethod("Method"));

lua code:

method('hello', 'world')
method(1, 2)

Is it possible?

NLua with unity

I'm about to use NLua with UnityEngine, and there are some questions:

1、How to get the lua stack trace when lua error, it's very hard to debug with it's default exception info
2、How to export my own class to lua? (I can use luanet to export UnityEngine's class, like: Debug=luanet.UnityEngine.Debug)
3、It's possible to run NLua with UnityEngine on mobile platform

Thanks for awsome work and sorry for my poor English

Error installing NLua on Ubuntu?

Hi,
I tried to run autogen.sh on my Ubuntu laptop, resulting in this error:

config.status: error: cannot find input file: `Core/KopiLua/KopiLua/kopilua.pc.in'

configure file is created and run, but ends with this error

Is that a bug? or should I install NLua in some different way?

Zbynek

Defining a constant

Hi,

how can I define a hard-coded constant ?
for example, I want to define _VERSION which could be the current version of NLua (or the version of my application); so, when the user want to know the version, he could used :

print( _VERSION );

?
many thanks in advance,
sincerly,
Domi.

[Request] Data binding to Lua tables

Hey,

I am researching into the problem of binding WPF and Silverlight controls directly to LuaTables, in order to have immediate UI display of the contents of a table, or a specific field.

Proper data binding can be accomplished in two ways:

  1. The data source class (e.g. LuaTable) implements INotifyPropertyChanged and fires its PropertyChanged event when the Keys or Values collections have changed.
    or
  2. LuaTable extends ObservableCollection and implements the specifications of this class, mainly the firing of its CollectionChanged event when the contents of the table have changed.

    (The first way is simpler to implement but the second would additionally provide programmatic lua-less methods for dealing with the table content.)

    The problem boils down to LuaTable notifying through an event that its content have changed. I have been researching how to do this in Lua, and it seems that the traditional way is to use a proxy table and the metafunctions __index and __newindex. (See "Tracking table access" on http://www.lua.org/pil/13.4.4.html)

    Now, I need this feature for a WP app based on NLua, so I will develop it anyway. But I feel like it would be a neat addition to NLua, since it basically would unleash UI Data Binding, which is a powerful feature of WPF and Silverlight.

    So here are my questions:

    1. Library design wise, what would be the best way to fit this new feature in? Modifying LuaTable ? Extending LuaTable (writing a new class, e.g. ProxyLuaTable)? Other ideas?
    2. One of the problems of ObservableCollection is that it is not thread-safe. How does NLua/Lua deal with threads; especially when __index and __newindex are called in used code, are they called always in the same thread?

    Thanks for the input :)
    Cheers
    Brice

autogen.sh fails on fresh clone

Unimportant Git output trimmed.

chris@linux-workstation:~/src$ git clone git://github.com/NLua/NLua.git
Cloning into NLua...
chris@linux-workstation:~/src$ cd NLua/
chris@linux-workstation:~/src/NLua$ git submodule update --init --recursive
Submodule 'Core/KeraLua' (git://github.com/NLua/KeraLua.git) registered for path 'Core/KeraLua'
Submodule 'Core/KopiLua' (git://github.com/NLua/KopiLua.git) registered for path 'Core/KopiLua'
Submodule 'tests/LuaTests' (git://github.com/NLua/LuaTests.git) registered for path 'tests/LuaTests'
Cloning into Core/KeraLua...
Submodule path 'Core/KeraLua': checked out '1d25893d6e271a66381fd6082a4d5b24e38416a9'
Submodule 'external/lua' (git://github.com/NLua/lua.git) registered for path 'external/lua'
Submodule 'tests/LuaTests' (git://github.com/NLua/LuaTests.git) registered for path 'tests/LuaTests'
Cloning into external/lua...
Submodule path 'external/lua': checked out '8d2f2b0ee6eb1510f3c1cbe67065c93608c58dac'
Cloning into tests/LuaTests...
Submodule path 'tests/LuaTests': checked out '16d547989d8c83abe8c65fecb281a36caca88a35'
Cloning into Core/KopiLua...
Submodule path 'Core/KopiLua': checked out 'b5aba78c7c61a3f3e11dda325bfb290f2ec976ec'
Submodule 'tests/LuaTests' (git://github.com/NLua/LuaTests.git) registered for path 'tests/LuaTests'
Cloning into tests/LuaTests...
Submodule path 'tests/LuaTests': checked out '16d547989d8c83abe8c65fecb281a36caca88a35'
Cloning into tests/LuaTests...
Submodule path 'tests/LuaTests': checked out '16d547989d8c83abe8c65fecb281a36caca88a35'
chris@linux-workstation:~/src/NLua$ ./autogen.sh 
I am going to run ./configure with no arguments - if you wish 
to pass any to it, please specify them on the ./autogen.sh command line.
Running aclocal -I .  ...
Running automake --gnu  ...
configure.ac:5: installing `./install-sh'
configure.ac:5: installing `./missing'
Makefile.include:69: programfilesdir multiply defined in condition TRUE ...
Applications/LuaRunner/Makefile.am:13:   `Applications/LuaRunner/LuaRunner.make' included from here
Applications/LuaRunner/LuaRunner.make:93:   `Makefile.include' included from here
Makefile.include:65: ... `programfilesdir' previously defined here
Applications/LuaRunner/Makefile.am:13:   `Applications/LuaRunner/LuaRunner.make' included from here
Applications/LuaRunner/LuaRunner.make:93:   `Makefile.include' included from here
Makefile.include:70: programfiles_DATA multiply defined in condition TRUE ...
Applications/LuaRunner/Makefile.am:13:   `Applications/LuaRunner/LuaRunner.make' included from here
Applications/LuaRunner/LuaRunner.make:93:   `Makefile.include' included from here
Makefile.include:66: ... `programfiles_DATA' previously defined here
Applications/LuaRunner/Makefile.am:13:   `Applications/LuaRunner/LuaRunner.make' included from here
Applications/LuaRunner/LuaRunner.make:93:   `Makefile.include' included from here
Makefile.include:69: programfilesdir multiply defined in condition TRUE ...
ConsoleTest/Makefile.am:98:   `Makefile.include' included from here
Makefile.include:65: ... `programfilesdir' previously defined here
ConsoleTest/Makefile.am:98:   `Makefile.include' included from here
Makefile.include:70: programfiles_DATA multiply defined in condition TRUE ...
ConsoleTest/Makefile.am:98:   `Makefile.include' included from here
Makefile.include:66: ... `programfiles_DATA' previously defined here
ConsoleTest/Makefile.am:98:   `Makefile.include' included from here
Makefile.include:69: programfilesdir multiply defined in condition TRUE ...
Core/KeraLua/Makefile.am:13:   `Core/KeraLua/KeraLua.make' included from here
Core/KeraLua/KeraLua.make:69:   `Makefile.include' included from here
Makefile.include:65: ... `programfilesdir' previously defined here
Core/KeraLua/Makefile.am:13:   `Core/KeraLua/KeraLua.make' included from here
Core/KeraLua/KeraLua.make:69:   `Makefile.include' included from here
Makefile.include:70: programfiles_DATA multiply defined in condition TRUE ...
Core/KeraLua/Makefile.am:13:   `Core/KeraLua/KeraLua.make' included from here
Core/KeraLua/KeraLua.make:69:   `Makefile.include' included from here
Makefile.include:66: ... `programfiles_DATA' previously defined here
Core/KeraLua/Makefile.am:13:   `Core/KeraLua/KeraLua.make' included from here
Core/KeraLua/KeraLua.make:69:   `Makefile.include' included from here
Makefile.include:69: programfilesdir multiply defined in condition TRUE ...
Core/NLua/Makefile.am:125:   `Makefile.include' included from here
Makefile.include:65: ... `programfilesdir' previously defined here
Core/NLua/Makefile.am:125:   `Makefile.include' included from here
Makefile.include:70: programfiles_DATA multiply defined in condition TRUE ...
Core/NLua/Makefile.am:125:   `Makefile.include' included from here
Makefile.include:66: ... `programfiles_DATA' previously defined here
Core/NLua/Makefile.am:125:   `Makefile.include' included from here
Makefile.include:69: programfilesdir multiply defined in condition TRUE ...
NLuaTest/Makefile.am:101:   `Makefile.include' included from here
Makefile.include:65: ... `programfilesdir' previously defined here
NLuaTest/Makefile.am:101:   `Makefile.include' included from here
Makefile.include:70: programfiles_DATA multiply defined in condition TRUE ...
NLuaTest/Makefile.am:101:   `Makefile.include' included from here
Makefile.include:66: ... `programfiles_DATA' previously defined here
NLuaTest/Makefile.am:101:   `Makefile.include' included from here
configure.ac:57: required file `Core/KopiLua/kopilua.pc.in' not found
configure.ac:57: required file `Core/KopiLua/Makefile.in' not found
Running autoconf ...
Running ./configure ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for pkg-config... /usr/bin/pkg-config
checking for gmcs... /opt/mono/bin/gmcs
checking for dmcs... /opt/mono/bin/dmcs
configure: creating ./config.status
config.status: error: cannot find input file: `Core/KopiLua/kopilua.pc.in'

[KopiLua] Diffs between Lua 5.1.4 and 5.1.5 and between 5.1.5 and 5.2.2

I made some diffs between some Lua versions. The KopiLua's version is 5.1.5 but doesnt contain those commits. In the following link you can see also see the changes and that it doesnt in the KopiLua. Link: https://github.com/megax/luaupdate/commit/e4820326fd340726068f54a944883bf39b6eefb0
I also made a modify from 5.1.5 to 5.2.2 which it's possible to modify and update to the newest version the code. Link: https://github.com/megax/luaupdate/commit/46825e2e1cb87ea0e21f0c1b0f23b0fd9e671b42
The updates made from http://www.lua.org/ftp/#source souce codes. If it is needed, i will do the change between 5.1.4 and 5.1.5, however with the other together might be too much. But if there won't be any idea how to merge efficiently i will start working on it.

Hello, Megax.

P.S.: I wrote this to NLua project because KoliLua doesnt have an issue menu.

"." in key causes error

Although sloppy, the following is valid in Lua:
local junk = {} -- Create table
key = "dot.dot" -- Create the key
junk[key] = 1 -- assign value

Attempting the same thing from the C# side of NLua seems to cause an error:

LuaTable junk = (LuaTable) lua.DoString("return {}")[0]; // Create the table
string key = "dot.dot"; // Create the key
junk[key] = 1; // This causes a Lua error

System.DllNotFoundException: Unable to load DLL 'lua52'

I'm hoping this is a simple issue and that I've just been out of Visual Studio for too long to see the cause. I wrote a program using LuaInterface about seven years ago that's held up quite well, but I am now looking to add some new features.

The problem is: I don't appear to be able to get even simple projects using NLua to run (though everything compiles fine). At the point where they instantiate the Lua object, I'm seeing:

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'lua52': Th
e specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at KeraLua.NativeMethods.LuaLNewState()
   at KeraLua.Lua.LuaLNewState()
   at NLua.Lua..ctor()
   at jl_nlua_test.Program.Main(String[] args) in C:\LocalDocs\src\jl_nlua_test\
jl_nlua_test\Program.cs:line 34

This is while trying to execute the example code from the main git page.

I do have lua52.dll (as well as NLua.dll and KeraLua.dll) in my path (as well as in the directory of the test .exe).

I'm using Visual Studio 2008, which unfortunately doesn't seem new enough to load the solution the main NLua.sln such that I can build the dlls. So, I'm using the three packaged Win32 dlls (the dev box I have to do this on is 32-bit Win2k3 Server).

NLua fails on Win7 x64

Tried to build NLua on Windows 7 x64 with Visual Studio 2010 installed. Build is successful, but all tests fail.
This usually happens when compiling a x64 dll against a x86 one, or vice-versa. Maybe targeting x86 only instead of AnyCPU could help in this situation?!

Error:
Unbehandelte Ausnahme: System.BadImageFormatException: Es wurde versucht, eine Datei mit einem falschen Format zu laden. (Ausnahme von HRESULT: 0x8007000B)
bei KeraLua.NativeMethods.luaL_newstate()
bei NLua.Lua..ctor()
bei ConsoleTest.Program.Main(String[] args) in d:\Programmieren\NLua\NLua\ConsoleTest\Program.cs:Zeile 15.

Logfile of build process and failed tests can be found here https://gist.github.com/SystemKeeper/5717686

LuaBase finalizer does not free reference

https://github.com/NLua/NLua/blob/master/Core/NLua/LuaBase.cs#L59

If Dispose() is called on a managed Lua reference, it will be properly freed. However, if a managed Lua object is collected without being disposed, the unreference will not occur and the targeted Lua object will never be eligible in Lua's garbage collection process since it still has a reference outstanding.

_Interpreter.Dispose(_Reference) should be called even when disposeManagedResources is false; the Lua reference is not a managed resource and it should be released when the managed Lua object is finalized.

Issue Targeting x86 Platform

nuget.package/tools/net45/GetLibLuaPostBuildCmd.ps1

This file adds post build events that copy the wrong version of the native library for our project. We are developing on an x64 machine, but targeting x86 processors. Because the machine is x64, the install script assumes, incorrectly, that we desire the x64 library, and we get a Bad Image Format exception when we try to run the code.

Also, the path of the reference in the post-build event is hard coded to the development machine, which will result in a failure on our build server.

Maybe this is the same culprit as what is described in #66.

I get failure of TryGetValue in PushObject results in wrong data being passed back

When I have this running under Unity (Mono 2.0) I am catching the following problem ONLY on specific data types. Can anyone confirm, or at least explain the issue to me - I am going to assume a broken VM with broken Equals() implementation.

C# Side
struct Top { struct sub y; }
struct sub { struct sub2 z; }
struct sub2 { int someval; }

LUA Side:
-- x=new Top() from C#
print( "Z is type:" .. tostring( x.y.z:GetType() ) .. " should be sub2" )

Result:
Z is type: sub should be sub2

Any attempt at accessing past x.y results in getting back "y" from LUA.
The result seems to be due to TryGetValue's internal "Equals" incorrectly identifying two types as the same. Works fine in MSVC.NET 3.5/4+

Here is the code I inserted to find the issue, and it does hit the debug print and when I check types in LUA I get the message above.

======== SOURCE OF ERROR IN CODE:
ObjectTranslator.cs : PushObject

internal void PushObject (LuaState luaState, object o, string metatable)
...
bool found = objectsBackMap.TryGetValue(o, out index);
if ( found && o != objects[index]) // LMP - Added as extra catch test
Debug.Print("\tAlready found it @ index {0}, types DONT MATCH", index);
...
// So now index is wrong, its going to retrieve the wrong type

NuGet package doesn't copy correct lua52.dll

I added the NuGet package to my XNA project in VS 2010 Pro, but when I ran it it threw the following exception:

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

I tried adding lua52.dll to the project manually from the zip archive, but no matter which one I add (Win32, Win64, net35, net40, net45) it throws the same exception.

I have confirmed in each case the file was copied to the output directory, so I don't know why it can't find it.

Using Debug Hooks crashes Lua execution

I am using .NET 4.0 VS2010 c# winforms and created a GUI that accepts a lua file and executes it. I am using debug hook to show the line currently executing as well as to provide ability to Pause/Resume a running script.

I was previously using LuaInterface and it was working fine. Now after switching to NLua (and KeraLua), the code crashes at the line

lua.DoString(Script);

If I comment the below line that I call soon after creating the lua variable, the script executes fine.

lua.SetDebugHook(NLua.Event.EventMasks.LUA_MASKLINE, 0);

I could not make out what is happening, so any help is appreciated.

Thanks
Lee

testluaform_alt.lua crashes

Hi,

can you give me some clue about how to run "testluaform_alt.lua", it gives me an exception err on line 59 : no such type : System.Drawing.Point. I have tested with .net 3.5 and .net 4.0

Thanks in advance !
Domi.

Unit tests fail on 32-bit systems

Running ./run_all.linux.sh on a 32-bit system using a fresh clone succeeds up until tests are executed, at which point every test fails with:

NLuaTest.LuaTests.WriteArrayField : System.DllNotFoundException : lua51
at (wrapper managed-to-native) KeraLua.NativeMethods:luaL_newstate ()

It looks like this line in the tests file should reference both lib and lib64:

export LD_LIBRARY_PATH=$PWD/Core/KeraLua/external/lua/linux/lib64

That is, I think it should read:

export LD_LIBRARY_PATH=$PWD/Core/KeraLua/external/lua/linux/lib:$PWD/Core/KeraLua/external/lua/linux/lib64

Since only one liblua51.so is compiled automatically, this should not create any ambiguity.

Samples\form.lua crashes

Hi,

any idea why the samples\form.lua crashes ? it worked fine with LuaInterface

PS: I have loaded the clr package before : lua.LoadCLRPackage();

Thanks in advance,
Domi.

Forgotten things

Hi

Back in the old times when i made the first source i commented this out https://github.com/NLua/NLua/blob/master/Core/NLua/Lua.cs#L908 and also that is under this. I couldn't write these parts good enough after the implement of KopiLua.
If you have time you could make this work because i don't have enough image about how this should be solved. I am not really knowledgeable about the LuaInterface.

Bye, @megax

Get print() output

How can I catch the output from print() to use somewhere in my program? I have my own custom log window that redirects Console.Out, but I can't figure out how to trap Lua's print() function.

Is that possible, or am I SOL?

OSX DllNotFoundException

[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: lua52
at (wrapper managed-to-native) KeraLua.NativeMethods:LuaLNewState ()
at KeraLua.Lua.LuaLNewState () [0x00000] in :0
at NLua.LuaLib.luaL_newstate () [0x00000] in :0

..when running a simple C# console app in Xamarin Studio on OSX. So, essentially, NLua doesn't work for me at all.

[Question/Suggestion] .NET 4.5 async methods

Would it be possible to add support for the async methods in .NET 4.5 using Lua coroutines?

e.g. calling an async method from within a coroutine would cause NLua to yield and then resume when the method completes, imitating the behaviour of await in C#.

I can understand if there's no easy way of doing this.

[Request] Windows Store applications version

Is there any way to port this to support Windows Store applications. I tried to use WP8 assemblies but they don't work, I keep getting

"Requested Windows Runtime type 'lua52.Interop' is not registered."

luanet.load_assembly() throws FileNotFoundException

I've downloaded the NLua Win32 package, referenced the NLua.dll in my project, copied lua52.dll into my output folder and set x86 as target platform. However, trying to load any standard .Net assembly through luanet.load_assembly() is met with a FileNoutFoundException claiming that the requested assembly or one of its dependencies cannot be found.

Not sure what I'm doing wrong here. Also tried a few of the provided Lua samples, but as soon as it tries to load a .Net assembly it fails. "Pure" Lua scripts work just fine, though.

Quick sample code would be:

using (Lua lua = new Lua())
{
lua.DoString("luanet.load_assembly('System.Windows.Forms')");
}

getting .net type after using luanet.import_type

how do I get the .NET type after calling luanet.import_type

local ITextDocument = luanet.import_type "Microsoft.VisualStudio.Text.ITextDocument"

local typeOfITextDocument = ???

I did notice that when calling luanet.import_type it returns a ProxyType https://github.com/NLua/NLua/blob/master/Core/NLua/ProxyType.cs which contains UnderlyingSystemType. How do I call that property?

This doesn't seem to work.

local ITextDocument = luanet.import_type "Microsoft.VisualStudio.Text.ITextDocument"
local typeOfITextDocument = ITextDocument.UnderlyingSystemType

create signed version of nlua

I'm trying to use NLua inside a Visual Studio extension and it requires those dlls to be signed. Would be great to have both signed and unsigned version of dll files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.