Dreikblack Posted December 26, 2024 Share Posted December 26, 2024 If do something like that in lua script: EmitEvent(EVENT_WIDGETACTION, nil, 0, 0, 0, 0, 0, nil, "start.ultra") Quote Link to comment Share on other sites More sharing options...
Josh Posted December 26, 2024 Share Posted December 26, 2024 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); } )); Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted January 24 Solution Share Posted January 24 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); } )); Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
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.