lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 20, 2015 at 8:04 PM, Josh Simmons <simmons.44@gmail.com> wrote:
> On Tue, Apr 21, 2015 at 10:40 AM, Andrew Starks <andrew.starks@trms.com> wrote:
>
>> 4: C#/Windows is not the only target language/platform.
>
> I'm pretty sure you still need to use P/Invoke if you want to do
> native interop on Mono.

>>
>> Does anyone have experience with this or something similar? I'm
>> curious if anyone has tried using the "unsafe" keyword and just bound
>> Lua to C#, without an extensive wrapper. I'm also curious about any
>> alternatives.
>>
>
> I'm not sure what you mean by "just" but once you have something like this
> https://github.com/jsimmons/LuaSharp/blob/master/LuaWrap/LuaLib.cs (5.1)
> you can do whatever you like and have it run on all platforms. More
> automated things obviously require more magical stuff on the part of
> the C# library.
>

I guess I was approaching this differently than I would have
approached C++, but I shouldn't have. I don't program in C# and I'm
not writing the binding, so that's probably why I see it as "other".

>From looking at your repo (thank you!), it seems like it may be
similar to the choice that you face in C++:
1: basically use the stack as is, but wrap it in a simple "lua" object
2: using someone's library in an attempt to make using code in the
other language easier

I normally don't like the second approach, but i feel like it might be
pragmatic, in this case. I'm fuzzy about how to deal with C#'s garbage
collection, but that is almost certainly due to me knowing next to
nothing about C#. I have done enough reading and asking/listening to
know about P/invoke.

"just" referred to "just use the C API as-is, as much as possible."

Thank you!

-Andrew