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

unsigned char* support via lightuserdata #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

daurnimator
Copy link

This closes Issue #44

test = function(j)
return 'lqtL_islightuserdata(L, '..tostring(j)..')', 1
end,
onstack = 'string,',
Copy link
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
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
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
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
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
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
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
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