Lua API changes between 5.1 and 5.3 for interfacing with .Net

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua API changes between 5.1 and 5.3 for interfacing with .Net

Russell Haley
Hello,

TLDR;
Is there an easy way to get a handle on the C API changes between 5.1
and 5.3? I tried diffing the two lua.h files but wasn't sure if that's
the best course of action.

Complete:
I am exploring interfacing C# and .Net and there is a wonderful
collection of different paths, each in varying states of maintenance.
While there seems to be some attempts to re-create Lua in C#, I am
instead interested in directly interfacing with unmodified PUC-Lua
code.

>From what I see, there are two paths: NLua/KeraLua, and creating an
interface as per instructions here:

https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/

Once again, Kera/Lua *sort of* violates my desire for using unmodified
sources as it can only be built from their repository. (A brief
inspection seems to indicate they are compiling it as C++ as they've
changed the extensions.). If anyone knows better, please advise.

So, that leaves me with Thue Tuxen's engine. One path I shall take is
to compile 5.1 to test it, but I'm interested in knowing what sort of
API changes were made between 5.1 and 5.3. Which brings me to the
question posted at the top.

I have further questions about the modifications to the Lua53.dll
build that are required in the instructions (will it still work with C
components?), but will save that for another night (unless someone
feels like reading ahead!).

Thanks,

Russ

Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Charles Heywood
Apologies for my bluntness,


documents what should be all changes to the APIs, libraries, and language between versions.

On Mon, Jan 15, 2018 at 1:12 AM Russell Haley <[hidden email]> wrote:
Hello,

TLDR;
Is there an easy way to get a handle on the C API changes between 5.1
and 5.3? I tried diffing the two lua.h files but wasn't sure if that's
the best course of action.

Complete:
I am exploring interfacing C# and .Net and there is a wonderful
collection of different paths, each in varying states of maintenance.
While there seems to be some attempts to re-create Lua in C#, I am
instead interested in directly interfacing with unmodified PUC-Lua
code.

>From what I see, there are two paths: NLua/KeraLua, and creating an
interface as per instructions here:

https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/

Once again, Kera/Lua *sort of* violates my desire for using unmodified
sources as it can only be built from their repository. (A brief
inspection seems to indicate they are compiling it as C++ as they've
changed the extensions.). If anyone knows better, please advise.

So, that leaves me with Thue Tuxen's engine. One path I shall take is
to compile 5.1 to test it, but I'm interested in knowing what sort of
API changes were made between 5.1 and 5.3. Which brings me to the
question posted at the top.

I have further questions about the modifications to the Lua53.dll
build that are required in the instructions (will it still work with C
components?), but will save that for another night (unless someone
feels like reading ahead!).

Thanks,

Russ



--
--
Ryan | Charles <[hidden email]>
Software Developer / System Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Viacheslav Usov
In reply to this post by Russell Haley
On Mon, Jan 15, 2018 at 8:12 AM, Russell Haley <[hidden email]> wrote:


I do not think the information on the impossibility of calling __cdecl imports from managed code is accurate. Per https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute(v=vs.110).aspx , the [DllImport] attribute can have a CallingConvention field, one of whose possible values being Cdecl. See https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.callingconvention(v=vs.110).aspx for examples.

That means a stock Lua DLL should be usable from a .net application, if the imports are correctly decorated. I have not tried that, though.

Cheers,
V.
Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Viacheslav Usov
On Mon, Jan 15, 2018 at 11:02 AM, Viacheslav Usov <[hidden email]> wrote:

> I do not think the information on the impossibility of calling __cdecl imports from managed code is accurate.

I should have read the comments to that post. One of them said exactly what I said, but then there was a further complication, which was also explained to have been a misconception. See the entire thread at https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/#comment-36 .

Cheers,
V.
Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Russell Haley
In reply to this post by Charles Heywood
On Mon, Jan 15, 2018 at 1:39 AM, Charles Heywood <[hidden email]> wrote:
> Apologies for my bluntness,
>
> https://www.lua.org/manual/5.2/manual.html#8
> https://www.lua.org/manual/5.3/manual.html#8
>
> documents what should be all changes to the APIs, libraries, and language
> between versions.

Apologies unnecessary, I'm just casting about seeing if there were
other resources I might have missed. I shall move forward with the
resources above.

Thanks,
Russ

> On Mon, Jan 15, 2018 at 1:12 AM Russell Haley <[hidden email]> wrote:
>>
>> Hello,
>>
>> TLDR;
>> Is there an easy way to get a handle on the C API changes between 5.1
>> and 5.3? I tried diffing the two lua.h files but wasn't sure if that's
>> the best course of action.
>>
>> Complete:
>> I am exploring interfacing C# and .Net and there is a wonderful
>> collection of different paths, each in varying states of maintenance.
>> While there seems to be some attempts to re-create Lua in C#, I am
>> instead interested in directly interfacing with unmodified PUC-Lua
>> code.
>>
>> >From what I see, there are two paths: NLua/KeraLua, and creating an
>> interface as per instructions here:
>>
>> https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/
>>
>> Once again, Kera/Lua *sort of* violates my desire for using unmodified
>> sources as it can only be built from their repository. (A brief
>> inspection seems to indicate they are compiling it as C++ as they've
>> changed the extensions.). If anyone knows better, please advise.
>>
>> So, that leaves me with Thue Tuxen's engine. One path I shall take is
>> to compile 5.1 to test it, but I'm interested in knowing what sort of
>> API changes were made between 5.1 and 5.3. Which brings me to the
>> question posted at the top.
>>
>> I have further questions about the modifications to the Lua53.dll
>> build that are required in the instructions (will it still work with C
>> components?), but will save that for another night (unless someone
>> feels like reading ahead!).
>>
>> Thanks,
>>
>> Russ
>>
>
>
> --
> --
> Ryan | Charles <[hidden email]>
> Software Developer / System Administrator
> https://hashbang.sh

Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Russell Haley
In reply to this post by Viacheslav Usov
On Mon, Jan 15, 2018 at 3:00 AM, Viacheslav Usov <[hidden email]> wrote:

> On Mon, Jan 15, 2018 at 11:02 AM, Viacheslav Usov <[hidden email]>
> wrote:
>
>> I do not think the information on the impossibility of calling __cdecl
>> imports from managed code is accurate.
>
> I should have read the comments to that post. One of them said exactly what
> I said, but then there was a further complication, which was also explained
> to have been a misconception. See the entire thread at
> https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/#comment-36
> .
>
> Cheers,
> V.

Thanks V, I've got it compiled and mostly working. I'm getting an
error trying to push a string on the stack, but it's doing quite a bit
of other things successfully up to that point. I'll post
questions/code tomorrow. zzzzzzzzzz

Thanks everyone!
Russ

Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Vinicius Jarina
Hi Russell
Just a heads up that I've updated KeraLua to Lua 5.3 with no modifications. I've also created a NuGet package to make easier to use it https://www.nuget.org/packages/KeraLua/

On Tue, Jan 16, 2018 at 3:01 AM Russell Haley <[hidden email]> wrote:
On Mon, Jan 15, 2018 at 3:00 AM, Viacheslav Usov <[hidden email]> wrote:
> On Mon, Jan 15, 2018 at 11:02 AM, Viacheslav Usov <[hidden email]>
> wrote:
>
>> I do not think the information on the impossibility of calling __cdecl
>> imports from managed code is accurate.
>
> I should have read the comments to that post. One of them said exactly what
> I said, but then there was a further complication, which was also explained
> to have been a misconception. See the entire thread at
> https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/#comment-36
> .
>
> Cheers,
> V.

Thanks V, I've got it compiled and mostly working. I'm getting an
error trying to push a string on the stack, but it's doing quite a bit
of other things successfully up to that point. I'll post
questions/code tomorrow. zzzzzzzzzz

Thanks everyone!
Russ

Reply | Threaded
Open this post in threaded view
|

Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Russell Haley
Thanks so much! I saw you closed the issue I opened. ‎I look forward to testing as soon as I get some free time. 

‎Kind Regards,

Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
From: Vinicius Jarina
Sent: Monday, January 28, 2019 2:45 PM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: Lua API changes between 5.1 and 5.3 for interfacing with .Net

Hi Russell
Just a heads up that I've updated KeraLua to Lua 5.3 with no modifications. I've also created a NuGet package to make easier to use it https://www.nuget.org/packages/KeraLua/

On Tue, Jan 16, 2018 at 3:01 AM Russell Haley <[hidden email]> wrote:
On Mon, Jan 15, 2018 at 3:00 AM, Viacheslav Usov <[hidden email]> wrote:
> On Mon, Jan 15, 2018 at 11:02 AM, Viacheslav Usov <[hidden email]>
> wrote:
>
>> I do not think the information on the impossibility of calling __cdecl
>> imports from managed code is accurate.
>
> I should have read the comments to that post. One of them said exactly what
> I said, but then there was a further complication, which was also explained
> to have been a misconception. See the entire thread at
> https://ttuxen.wordpress.com/2009/11/03/embedding-lua-in-dotnet/#comment-36
> .
>
> Cheers,
> V.

Thanks V, I've got it compiled and mostly working. I'm getting an
error trying to push a string on the stack, but it's doing quite a bit
of other things successfully up to that point. I'll post
questions/code tomorrow. zzzzzzzzzz

Thanks everyone!
Russ