lua-users home
lua-l archive

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


Hello,

I'm working on a C programs using Lua as embedded language.

At Lua side, I'm defining a table on witch a filed need to be a function as :

_, err = Broker:subscribe {
        { topic = "/tata", function = myfunc },
        { topic = "tutu", function = func2 }
}

And I know at C side I have to look up for TFUNCTION for "function" field.
My reading function is creating a structure containing
- a string, the topic,
- and a "reference" or something to keep track of the function

now my question :
1/ How can I store TFUNCTION at C side ?
2/ How my C code can "call" this Lua function ?

If it's not so clear, please have a look on my code here : https://github.com/destroyedlolo/Selene/blob/master/src/MQTT.c
especially on line 79.

Thanks

Laurent

---
The misspelling master is on the Web.
  _________ 100 % Dictionnary Free !
/               /(
/ Dico       / / Pleins d'autres fautes sur
/________/ /
(#######( / http://destroyedlolo.info
Quoi, des fautes d'orthographe! Pas possible ;-D.