-
Notifications
You must be signed in to change notification settings - Fork 20
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
[ -- additional -- ] Lambda and std::function #59
Comments
Hm that's not a bad idea. It would cut down on the number of stack specializations. Though I'm not sure that is valid for both 32bit and 64bit targets. signedness can become an issue depending on the compiler/platform. |
Lamda wise, you can pass them into a std::function and pass that around no? (not that I wont add lambda support, but it is a work around) |
That's ok. I'll see about adding lambda support . As for your setRect example, that's a bit more interesting. I haven't added passing table's back to c++ yet. But your example would likely never be possible as written. setRect would have to take a map or a LuaGlueTable (when ever it gets added). Right now you can just make setRect take x,y,w,h as individual parameters. Theres a "func" overload to put a wrapper around a given method. It's technically called a decorator and lets you transform the inputs to different forms. Helpful for cases like this... it'd look something like: (which probably wont work as shown)
I /could/ try and figure out if table properties match a given object's registered properties. I'll look into that as well. It'd be slower than passing things as individual arguments, but it would be handy. |
It seems std::function support in |
Ok, bare lambda if possible, aren't simple (as far as I know, you can't "detect" the type of a lambda in any way). So just wrap them in a std::function for now. I've also added a stdfunc example to test a couple uses of them. I've also fixed some uses of std::function. |
Hm, ok. I'll put that on the list of things to add. more complete support for std::function would be useful, like allowing non direct properties to get handed two std::functions to "get" and "set" them. |
I was trying to add raw lambda support earlier, but clearly my C++11 knowledge is poor :(. Thats fairly clever :o I'll play with that a bit. I'm working on a large refactor of the Class/Type support, so I may not get to these requests right away. I have no time frame for when I'll get the big changes in and working. I'll do bug fixes on master in the mean time, but new features and big additions will have to wait till I've got the new branch merged with master. |
Also, you know what would help me, is if you could split all of your feature requests into separate issues? That would really help me keep track of them :) |
There should be a "Add Labels" column beside the issue form with labels in it you can click, one is "enhancement". if it's not there, I'll have to tag em. |
Ok. Not a problem. |
Hm, I'd prefer to have issues on each one. Much easier for me to keep track of your requests. |
No, one per group of similar additions. like one for the integer additions, one for the std::function stuff, etc. go back and look at your other sumissions as well and make sure each one is only about one thing. |
Example:
Todo:
Code:
Add file: LuaGlueStdFuncMethod.h
Edit file: LuaGluaClass.h
Fix:
Edit LuaGluFunction.h[142]
Edit LuaGluFunction.h[157]
Edit LuaGluFunction.h[191]
Add LuaGlue.h
The text was updated successfully, but these errors were encountered: