Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access elements of a C++ image array (struct) with Lua? #2894

Open
Jonathhhan opened this issue Apr 25, 2024 · 0 comments
Open

How to access elements of a C++ image array (struct) with Lua? #2894

Jonathhhan opened this issue Apr 25, 2024 · 0 comments

Comments

@Jonathhhan
Copy link

Jonathhhan commented Apr 25, 2024

I have an array of this struct (sd_image_t*) as the return value of a function:

typedef struct {
    uint32_t width;
    uint32_t height;
    uint32_t channel;
    uint8_t* data;
} sd_image_t;

In C++ I can call sd_image_t[n].data while with SWIG created Lua bindings I can only call sd_image_t.data (which seems to be a pointer to all data of the struct). Is there a way to wrap it, so that I can call it like in C++?
Could %naturalvar help in my case? https://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_member_data
Here I tried to describe my issue too: https://forum.openframeworks.cc/t/swig-lua-binding-for-accessing-elements-of-an-image-array/43429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant