Open amerkoleci opened 10 years ago
Due to the way call's are generated at compile time, it may not work. but please test it if you can. I've had some ideas on how to make it work (if it doesn't).
It looks like no, as is it isn't supported. The magic C++ template magic is not able to detect default arguments. I'm not actually sure how to support variable number of arguments at the moment because of the way we bind to functions using stored function pointers that pull their type from the passed function.
I have an idea, but i'm not sure if it'll actually work. I will try to implement it, but I give no guarantees.
Yet you know how many arguments you have in the lua stack. So "reading" only those arguments and calling the function with only those doesn't work ?
On Wed, Sep 3, 2014 at 9:02 PM, Thomas Fjellstrom notifications@github.com wrote:
It looks like no, as is it isn't supported. The magic C++ template magic is not able to detect default arguments. I'm not actually sure how to support variable number of arguments at the moment because of the way we bind to functions using stored function pointers that pull their type from the passed function.
I have an idea, but i'm not sure if it'll actually work. I will try to implement it, but I give no guarantees.
— Reply to this email directly or view it on GitHub https://github.com/Tomasu/LuaGlue/issues/68#issuecomment-54348703.
Jean-Marc Le Roux
Founder and CEO of Aerys (http://aerys.in)
Blog: http://blogs.aerys.in/jeanmarc-leroux Cell: (+33)6 20 56 45 78 Phone: (+33)9 72 40 17 58
Yes, we do know how many items are in the stack when our internal call method is called, the main problem is when storing function pointers, they store ALL of the parameters as part of the function pointer type, not just the required ones. So we actually have to pass ALL of the parameters or the compiler will complain when we try to call the function through that function pointer.
A separate set of code that stores the function pointer as a var-arg function pointer might work, but thats a bunch of code duplication, and may be less safe. I'm also not convinced it'll end up working properly either.
I have the method:
CameraPtr is shared_ptr
Will this work and can I omit default params in Lua?