LuaBridge3
LuaBridge3 copied to clipboard
Compile error with Cfunc property getter/setter
I am getting a compiler error from the following addProperty
call:
class foo
{
int value{};
public:
int get_value_cfunc(lua_State* L) const
{
luabridge::Stack<int>::push(L, value).throw_on_error();
return 1;
}
int set_value_cfunc(lua_State *L)
{
value = luabridge::Stack<int>::get(L, 2).value();
return 0;
}
};
luabridge::getGlobalNamespace(L)
.beginClass<foo>("foo")
.addProperty("value", &foo::get_value_cfunc, &foo::set_value_cfunc)
.endClass();
I am guessing it may be because the getter and setter cfuncs are class members. There is no similar problem with addFunction
. Should this be allowed?
I guess it could easily be fixed by making the cfuncs static. If that is sufficient solution for you, go ahead and close this issue.
I think that addProperty might miss overloads for member cfunctions (addFunction should have them). Will add them