wxlua
wxlua copied to clipboard
How to get a pointer to C++ object from wxLua object?
Hi!
I would like to send events to the wxFrame created in Lua from another thread from C++. According to the wxWidgets docs, I need the thread-safe wxEvtHandler::QueueEvent method. However, in order to use it, I need a pointer to an instance of wxEvtHandler (in my case, a wxFrame or wxApp, doesn't really matter).
The docs say that wxLua userdata objects have a special metatable, and its __tostring method:
print(wx.wxPoint()){.lua} prints "userdata: 0x858df5c [wxPoint(0x84ab550, 251)]", where 0x858df5c is the Lua userdata address, 0x84ab550 is the address of the wxPoint object
Is it possible to extract that pointer from wxLua userdata objects to pass it to my C++ code?