gsoc-2013 - lua plugins



Juan,

I've been looking into libquvi project in order to understand how they integrate their lua scripts with c code.
It works really nice[0] (lua 5.1) we just need to be careful with stack control...

ps: I'm calling as 'lua-factory' the glue code between grilo and lua plugins.

Calling a c function from lua also works fine[1].
We can create a 'module' in c to give lua some help functions and also a way to alert the lua-factory that an async call has finished.

If I understand right, the lua plugins would take care of search/browse/query procedures with lua code; the lua-factory (c code) would translate the return from lua into GrlMedia / GrlSource besides dealing with calls and async responses from lua code.

There are some core understandings that I'm still looking into but any thoughts would be very appreciated.

Best regards,

[0] e.g - running lua script to convert html entities
1-) line 45: "l_load_util_script" loads a lua function from lua script ("convert_entities" and "convert_entities.lua")
2-) line 51: passing a parameter to lua function
3-) line 57: calling the lua function with the text to convert; It waits 1 arg in return;
(c calling) http://repo.or.cz/w/libquvi.git/blob/HEAD:/src/lua/util/exec_util_convert_entities.c#l45

(lua script) http://repo.or.cz/w/libquvi-scripts.git/blob/HEAD:/share/common/quvi/entity.lua#l33

[1] e.g - running c hash functions

line 83-86: register c functions defined in (3th param) quvi_*_reg_meth in lua quvi.* module (2nd param)
(registering c functions) http://repo.or.cz/w/libquvi.git/blob/HEAD:/src/lua/init.c#l76

line 38 & 44: calling c function to md5/sha1 hash
(lua calling) http://repo.or.cz/w/libquvi-scripts.git/blob/HEAD:/share/common/quvi/hash.lua#l38

getting lua parameters and doing the c code..
(the c function) http://repo.or.cz/w/libquvi.git/blob/HEAD:/src/lua/quvi/crypto/hash.c#l38


--------------------
--
Victor Toso


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