-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__eq in metatable for C++ objects? #31
Comments
Unfortunately I stopped using Lua a while ago, so I really don't remember much about all this. |
Ok, thank you for all your great work! As PowerDNS we are pondering taking Thanks again! On Mon, Dec 21, 2015 at 12:39:27PM -0800, tomaka wrote:
|
Sure! I haven't touched any C++ code for the past year or so, and have no plan to go back to this language, so it's not me who is going to maintain this library. |
Hello @tomaka, I am working with @ahupowerdns on PowerDNS. Would you be open to handing over the whole repository (what Github calls 'Transfer ownership' in the repo settings' 'Danger Zone') so the issues and open pulls also become our problem? |
Upstream from PowerDNS: don't shadow variables
Our (PowerDNS) love for luawrapper continues to be grandiose! We've built most of dnsdist on it, and now also the Lua integration in the upcoming Recursor 4.x release, thanks!
To make things really shine, we'd like users to be able to compare two DNSName objects in Lua like this:
if(nameA == nameB) then .. stuff .. end
Where nameA are created with newDN() which returns a DNSName.
I've tried:
d_lw->registerFunction("__eq", &DNSName::operator==);
Which would of course be grand. When I explicitly call it (nameA:__eq(nameB)), it works too. But it is not in the metatable, so nameA==nameB does not call operator==. Unsure what it does call, btw! (perhaps it compares exact object identity?).
I see that I could do it with writeVariable to a specific named Lua-side object, but I don't think I could do this from my (C++ based) newDN() function, since my object need not even have a name yet.
Naively, it looks like registerFunction needs a variant for writing to metatables, but I could be wrong.
Help! :-)
The text was updated successfully, but these errors were encountered: