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

Started by
1 comment, last by CodaKiller 14 years, 11 months ago
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<>())
			.def_readwrite("window", &E_RENDER_TARGET_DESC::window)
			.def_readwrite("left", &E_RENDER_TARGET_DESC::left)
			.def_readwrite("top", &E_RENDER_TARGET_DESC::top)
			.def_readwrite("right", &E_RENDER_TARGET_DESC::right)
			.def_readwrite("bottom", &E_RENDER_TARGET_DESC::bottom)
	];




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 <unknown>(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.
Remember Codeka is my alternate account, just remember that!
Advertisement
You appear not to be supplying both arguments to your CreateRenderTarget function.
Quote:Original post by sprite_hound
You 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.
Remember Codeka is my alternate account, just remember that!

This topic is closed to new replies.

Advertisement