Jump to content

In Lua full params EmitEvent is not bind?


Go to solution Solved by Josh,

Recommended Posts

Posted

This is the binding code. I can see from looking at it what the issue is. With sol, nil does not automatically map to shared pointers, so separate overloads have to be added to handle that.

		L->set_function("EmitEvent", sol::overload(
			[](const Event& e) { return EmitEvent(e); },
			[](const int id, shared_ptr<Object> source) { return EmitEvent(id, source); },
			[](const int id) { return EmitEvent(id); },
			[](const int id, shared_ptr<Object> source) { return EmitEvent(id, source); },
			[](const int id, shared_ptr<Object> source, const int data) { return LuaEmitEvent(id, source, data,0,0,0,0,nullptr,""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y) { return LuaEmitEvent(id, source, data, x, y, 0, 0, nullptr, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h) { return LuaEmitEvent(id, source, data, x, y, w, h, nullptr, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o) { return LuaEmitEvent(id, source, data, x, y, w, h, o, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o, std::string s) { return LuaEmitEvent(id, source, data, x, y, w, h, o, s); }
		));

 

Let's build cool stuff and have fun. :)

  • 4 weeks later...
  • Solution
Posted

I added all possible combinations of NULL pointers:

		L->set_function("EmitEvent", sol::overload(
			[](const Event& e) { return EmitEvent(e); },
			[](const int id, shared_ptr<Object> source) { return EmitEvent(id, source); },
			[](const int id) { return EmitEvent(id); },
			[](const int id, shared_ptr<Object> source) { return EmitEvent(id, source); },
			[](const int id, shared_ptr<Object> source, const int data) { return LuaEmitEvent(id, source, data,0,0,0,0,nullptr,""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y) { return LuaEmitEvent(id, source, data, x, y, 0, 0, nullptr, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h) { return LuaEmitEvent(id, source, data, x, y, w, h, nullptr, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o) { return LuaEmitEvent(id, source, data, x, y, w, h, o, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o, std::string s) { return LuaEmitEvent(id, source, data, x, y, w, h, o, s); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, std::nullptr_t o) { return LuaEmitEvent(id, source, data, x, y, w, h, o, L""); },
			[](const int id, shared_ptr<Object> source, const int data, const int x, const int y, const int w, const int h, std::nullptr_t o, std::string s) { return LuaEmitEvent(id, source, data, x, y, w, h, o, s); },
			[](const int id, std::nullptr_t source) { return EmitEvent(id, source); },
			[](const int id, std::nullptr_t source, const int data) { return LuaEmitEvent(id, source, data, 0, 0, 0, 0, nullptr, ""); },
			[](const int id, std::nullptr_t source, const int data, const int x, const int y) { return LuaEmitEvent(id, source, data, x, y, 0, 0, nullptr, L""); },
			[](const int id, std::nullptr_t source, const int data, const int x, const int y, const int w, const int h) { return LuaEmitEvent(id, source, data, x, y, w, h, nullptr, L""); },
			[](const int id, std::nullptr_t source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o) { return LuaEmitEvent(id, source, data, x, y, w, h, o, L""); },
			[](const int id, std::nullptr_t source, const int data, const int x, const int y, const int w, const int h, shared_ptr<Object> o, std::string s) { return LuaEmitEvent(id, source, data, x, y, w, h, o, s); }
			[](const int id, std::nullptr_t source, const int data, const int x, const int y, const int w, const int h, std::nullptr_t o) { return LuaEmitEvent(id, source, data, x, y, w, h, o, L""); },
			[](const int id, std::nullptr_t source, const int data, const int x, const int y, const int w, const int h, std::nullptr_t o, std::string s) { return LuaEmitEvent(id, source, data, x, y, w, h, o, s); }
		));

 

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...