Page 1 of 1

LUA as GUI and C as logic

Posted: 22 Feb 2017 10:09
by ASantosVal
Short version of the question:
Can I make a LUA user interface as an extension which communicates with C, so C does the real work?

Long version of the question:
I'm currently developing a LUA extension that it's meant to stream local media to uPnP renderers on the LAN. The problem is that the actual streaming code it's way easier to develop in C, which already has libraries for that. So what I need is a way to make LUA and C communicate.

I have found this documentation about the LUA and C API: https://www.lua.org/pil/24.html

The problem I see with that is that the C code would work "out of VLC" and I wouldn't reuse the useful code already integrated in VLC. (Not sure about this, please correct me if I'm wrong)

Another option I am considering is to extend VLC's LUA API so it can access the code I develop, but seems really complicated.

Has somebody ever tried something similar? Any thoughts or recommendations?

Re: LUA as GUI and C as logic

Posted: 22 Feb 2017 10:54
by Etoh
"stream local media to uPnP renderers on the LAN" - not sure what role VLC has in all this.

Depending on what you are doing, you might just be able to create a server/client that VLC can connect with and avoid Lua altogether.

What sort of communication bandwidth were you thinking of? You can make a Lua script a host script, but that might not be great for lots of data transfer.

Re: LUA as GUI and C as logic

Posted: 22 Feb 2017 11:03
by ASantosVal
Sorry if it wasn't well explained. The idea is to take a file that it's been played on VLC and stream it easily to a smart TV or something similar. Lua would be just the way to select the device you want to stream to and then offer some basic control (play, pause, volume up/down, etc.). VLC should control the stream.

I hope I have explained myself, English is not my main language. :(