[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Store reference to a function to be called later
- From: Jose Marin <jose_marin2@...>
- Date: Fri, 12 Aug 2011 04:57:08 -0700 (PDT)
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.