lua-users home
lua-l archive

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


What he needs to do is store the Lua function entry as such (make a copy, forget about C pointers) in the Lua registry or a userdata's environment. This is a common need and many source codes will carry samples. Then have a C side common callback which picks up that stored ref to the Lua function and executes it. I've made a helper for all this but that code is not public.

- asko

On 17.10.2009, at 21.03, Wesley Smith <wesley.hoke@gmail.com> wrote:

I don't completely follow, but you can store arbitrary function pointers as lightuserdata.

wes

On Oct 17, 2009, at 1:47 AM, Jiří Prymus <jiri.prymus@gmail.com> wro te:

Hi,

I would like to know if there is any chance to convert lua function to c function. I program a small opencv wrapper and there is one wrapping
function where I need pointer to function. And that's a problem
because I can get only pointer to Lua function and when I convert it
to C function then it does nothing. I know that lua functions are
stored in tables and that's probably why it  doesn't work.

In fact my problem is function gtk_signal_connect(...) where slot
function is my lua function.

Thanks for answer.

With regards,
Jiri Prymus