Closed JMLX42 closed 10 years ago
Probably just another override.
Probably. And it looks like it doesn't work with std::shared_ptr either. Here is my stub class:
class LuaStub
{
public:
LuaStub() {}
std::shared_ptr<input::Mouse> mouse;
std::shared_ptr<input::Mouse>
getMouse()
{
return mouse;
}
};
This doesn't work:
_state
.Class<LuaStub>(name)
.prop("mouse", &LuaStub::mouse)
.end()
.glue();
but this works:
_state
.Class<LuaStub>(name)
.method("getMouse", &LuaStub::getMouse)
.end()
.glue();
Any idea? Is it relevant to create another issue or is it another missing override?
hm, I probably need to add some code to handle static properties that are wrapped in a shared_ptr. didn't think about that.
if you want to use the mouse member with a getter and setter, you have to use the prop("name", &Class::getProp, &Class::setProp) override.
I know. But I actually wanted to skip the getter/setter for this one. I will create a separate issue.
On Sun, Dec 15, 2013 at 8:39 PM, Thomas Fjellstrom <notifications@github.com
wrote:
if you want to use the mouse member with a getter and setter, you have to use the prop("name", &Class::getProp, &Class::setProp) override.
— Reply to this email directly or view it on GitHubhttps://github.com/Tomasu/LuaGlue/issues/22#issuecomment-30618284 .
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
Any update on the ref. issue?
It may or may not work now. I did fix some const/ref stuff in the last push. but I didn't specifically test it.
I just added support for the getter being a const method. seems to work here.
When you get a chance to test, let me know how you fare. I'd like to get these const/ref issues fixed. :) thanks.
I'm assuming this is fixed now. Re-open if it isn't.
Hello,
I just you added LuaGlueClass::prop() to handle properties through proper getter/setter. Thank you for that!
One problem we have though is that it won't work with const arguments. Yet a setter/setter is likely to get const arguments or return a const value.
How can we fix this?