-
Notifications
You must be signed in to change notification settings - Fork 34
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
base: master
Are you sure you want to change the base?
Conversation
test = function(j) | ||
return 'lqtL_islightuserdata(L, '..tostring(j)..')', 1 | ||
end, | ||
onstack = 'string,', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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....
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
bump |
This closes Issue #44