Open maxdemarzi opened 2 years ago
Are the arguments being passed in from Lua already std::vectors, or are they Lua tables that you want converted to vectors? If it's the former, you might try accepting them by const reference rather than by value (which would be more efficient anyway).
No luck.
lua.set_function("NodesGet", sol::overload(
[this](const std::vector<Link>& links) { return this->NodesGetByLinksViaLua(links); },
[this](const std::vector<uint64_t>& ids) { return this->NodesGetViaLua(ids); }
));
Gives me:
sol: no matching function call takes this number of arguments and the specified types
And:
lua.set_function("NodesGet", sol::overload(
[this](std::vector<Link> links) { return this->NodesGetByLinksViaLua(links); },
[this](std::vector<uint64_t> ids) { return this->NodesGetViaLua(ids); }
));
Gives me this error when I try to pass uint64s:
An exception has occurred: stack index -1, expected userdata, received number: value is not a valid userdata
Any other ideas?
I was trying to overload a function this way:
However it doesn't matter if I send in a vector of uint64_t or Link, it just takes the first entry (uint64_t). I can work around it by manually asking for the inner type of the table and then returning the corresponding function:
But, please tell me there is a better way to overload vectors arguments... I have a ton of these functions I need to overload.