Skip to content

How to get a pointer to C++ object from wxLua object? #142

Description

@sokolas

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions