lua-users home
lua-l archive

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


Hi.

I´m returning to work with Lua, and started to study the new features of the most recent version.

However, I still haven´t found a good solution to a problem.

I must store the refernce to a function in C, to be called later, like in this example:
I have a C function registered in Lua, and have this prototype:

AddButton(label, x, y, width, height, callback)

And can be called like this:

AddButton("Play", 10, 10, 50, 20, OnPlay)


I wouldn´t like to store the string "OnPlay", and make a search on the register for the function, would like to store the reference to the fucntion itself, to be directly called when the button is pressed.

Any suggestions?

Thanks


Jose