Open devgs opened 1 year ago
Looks like on godbolt it works with:
Lua 5.3.5
sol2 3.2.1
-std=c++17
x86-64 gcc 10.1
It could be a compiler specific issue. A git bisect or similar could be done to find which commit breaks it. Maybe you could post your compiler platform+version and try the working versions above if you can reproduce with them.
Huh!
Actually I was using a develop branch. Then I've bisected tags down to v3.3.0. It seems to be the version where the bug was introduced. Indeed, on v3.2.1 everything is fine. How unfortunate.
I've simplified one of the examples and added a repeated registration of the same type. Depending on the number of registrations (cycles) script will either work as expected or throw an error
attempt to index a sol.foo value (global 'x')
.For me it breaks at 2, works at 3, 4, then breaks again at 5, works at 6, 7, breaks again at 8, ...
I've tried multiple things: using different names, manual unregistering with no avail. Decided not to complicate the example.
Looking at the source code and tests it seems that this should work as each new registration shall replace the previous one, if any. It seems that somehow the metatable gets broken, but I'm unable to track down the specific place.