# Why can't I use a class as a property in luabind?

This topic is 3322 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well my problem is simple, I'm trying to use a class which I have defined in lua bind as a property for another class but it won't let me. Here is the class:
class E_RENDER_TARGET_DESC
{
public:
E_RENDER_TARGET_DESC()
{
window = NULL;
left = 0;
top = 0;
right = 1;
bottom = 1;
}

E_WINDOW*							window;
float								left;
float								top;
float								right;
float								bottom;
};


Here is where I define it:
	luabind::module(g_Lua)
[
luabind::class_<E_RENDER_TARGET_DESC>("CreateRenderTargetDesc")
.def(luabind::constructor<>())
];


Lua source:
	WindowDesc = CreateWindowDesc()
WindowDesc.name = "Ether"
WindowDesc.icon = "Ether.ico"
WindowDesc.left = 0
WindowDesc.top = 0
WindowDesc.width = 1024
WindowDesc.height = 768
WindowDesc.close = true
WindowDesc.maximize = false
WindowDesc.minimize = true
WindowDesc.sizeable = false
GameWindow = CreateWindow( WindowDesc )

RenderTargetDesc = CreateRenderTargetDesc()
RenderTargetDesc.window = GameWindow
RenderTargetDesc.left = 0
RenderTargetDesc.top = 0
RenderTargetDesc.right = 1
RenderTargetDesc.bottom = 1
RenderTarget = CreateRenderTarget( RenderTargetDesc )


And lastly this is the error I receive from luabind:
Quote:
 No matching overload found, candidates:void (CreateRenderTargetDesc&,CreateWindow* const&)
My guess is that I was suppose to define something in E_WINDOW which lets you use it as a property or something.

##### Share on other sites
You appear not to be supplying both arguments to your CreateRenderTarget function.

##### Share on other sites
Quote:
 Original post by sprite_houndYou appear not to be supplying both arguments to your CreateRenderTarget function.

No actually I figured it out on my own, you have to create a get and set function and use ".property" to define it in luabind. Not sure why it works but it does and thats all that matters.

1. 1
2. 2
3. 3
4. 4
Rutin
18
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631423
• Total Posts
3000005
×