lua-users home
lua-l archive

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


Hello,

I am new to Lua and I find this language very interesting, thats why Ive been playing with it during the last few days. It is time for my first problem (maybe my last) : Ive made a CreateButton function which I can call from my lua scripts : in the script, when I create a button, I then create a lua function named "ButtonNameClick()" where ButtonName is the name of the button I create. I can then call the function from my C++ program. The problem I have is that in C++ I have a Button class, and a Click function. I dont want to use lua function in my button class code, I would like to make a function which copies my lua function into my c++ function without having to call the script each time.

To sum up : I have a GUI.cpp/h and a LUA.cpp/h. My LUA code uses the GUI code but the GUI code should not use the LUA code. In my LUA code I init LUA and stuff, I register my c++ functions named C reateButton, CreateWindow, etc. In CreateButton I would like to create a new button, but also copy the Click function which is in my script into my button function named OnClick. Ive tried many ways with pointer to functions for example, but I always have to use LUA in my GUI code in my OnClick function...
So thats why Im looking for a way to "copy" a function from LUA to C++...

Thank you in advance,
Sébastien RONSSE.



MSN 8 helps ELIMINATE E-MAIL VIRUSES. Get 2 months FREE*.