Call Lua function on button click

Fobaz

20-02-2011 14:38:53

Hello,
I'm trying to make a game using Ogre and MyGUI, and I wan't to make LUA scripting. How can I make Widget to call LUA function on click?
I'm using MyGUI 3.2.0 RC1 and newest LuaBind.

I'm trying to do that like this:
C++:

luabind::module(state) [
luabind::class_<MyGUI::Widget>("CWidget")
.def_readwrite("OnClick", &MyGUI::Widget::eventMouseButtonClick)
];

Lua:

buttonPtr.OnClick = function()
...
end

But it doesn't work. :(

I guess, I have to do something with delegates, but I have no idea what.