lua-users home
lua-l archive

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


On Tue, Nov 7, 2017 at 12:13 PM, Russell Haley <russ.haley@gmail.com> wrote:
> On Tue, Nov 7, 2017 at 11:32 AM, RAHUL KUMAR <ryadav.exe@gmail.com> wrote:
>> Hi folks,
>>
>> I have an Desktop application which runs Lua 5.3 had one of the library as C
>> dll and hence Lua loads (require) and make available all the functions.
>>
>> There are requests to move this application to web (existing web tools are
>> in Node.js). Is there any binding available for Lua 5.3 with Node.js? I see
>> there are bindings for 5.1 but not for 5.3
>
> There is a library that does the same thing with Lua as Node.js does
> with JavaScript. The library is called luvit and it's quite brilliant:
> https://luvit.io/. It uses the same backend C engine called libuv so
> the looping mechanisms are compatible. I also see no reason you can't
> call your Lua from within the JavaScript, but someone more experienced
> should be able to yay or nay that idea.
>
> I didn't use luvit because I found cqueues and lua-http which utilize
> Lua yielding to produce the same effect. I liked it so I stuck with
> it.
>
>> If not, what is best possible path i should take to port existing Lua module
>> ( C dll) to Node.js?
>
> On the back of a napkin I would say you could write a libuv extension
> to be called from node.js to make luvit calls and drop them on the
> same loop?

hmmm. Or just make plain old calls. Again, you could create a libuv
extension that would hold your interpreter context and just load and
run the byte code. I don't have a good handle on the lua C API or
Node.js, but I have been working with libuv so that's where my bias is
coming from...

>>
>> Regards,
>> Rahul