Skip to content

unsigned char* support via lightuserdata - #46

Open
daurnimator wants to merge 2 commits into
mkottman:masterfrom
daurnimator:master
Open

unsigned char* support via lightuserdata#46
daurnimator wants to merge 2 commits into
mkottman:masterfrom
daurnimator:master

Conversation

@daurnimator

Copy link
Copy Markdown

This closes Issue #44

Comment thread generator/types.lua

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure of this line.... I just copied it from above.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a check of what Lua stack should look like in order to correctly convert the type from Lua -> C++. Since we are dealing with userdata, I think it should state 'userdata'.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is it passed to/from? just the lua side type()?
For other purposes it might need to be lightuserdata....

Note: I have tested this (using QImage::bits) and everything seemed to work.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, by looking at the code, it only seems to be used to distinguish overloaded methods, so it should be relatively harmless...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what is it compared to?
I note that integer_type has integer; so it's probably not the lua type function....

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used to construct a "signature" of a method. It is generated in generator/classes.lua in function fill_wrapper_code, and subsequently used in print_metatable. The main idea was to use only a single overloaded function where there are multiple C++ versions that do not make sense in Lua. As an example - fun(char), fun(int) and fun(long) would all generate "integer" signatures, but the long version would get the least "defect" and therefore be chosen, the others will not be generated.

It is not actually used in any checking during runtime (there is another mechanism for that).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok then; should I make it userdata or lightuserdata?

@daurnimator

Copy link
Copy Markdown
Author

bump

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

Successfully merging this pull request may close these issues.

2 participants