Jump to content
  • Advertisement
Sign in to follow this  
CodaKiller

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.

If you intended to correct an error in the post then please contact us.

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<>())
			.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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!