SneakySquid / Circles

Some circle thing because I'm tired of people using surface.DrawTexturedRect and surface.DrawLine.
MIT License
72 stars 12 forks source link

Use _G Instead of _R #7

Closed Aws0mee closed 9 months ago

Aws0mee commented 9 months ago

It seems Rubat broke debug.getregistry, and I cannot find any information on why or if it will ever be fixed. Since this library uses the registry, it seems as though it's completely broken currently. Storing the table in _G should fix this with the same functionality.

SneakySquid commented 9 months ago

It still works fine with the changes to debug.getregistry.

Aws0mee commented 9 months ago

It still works fine with the changes to debug.getregistry.

Hey, did you make any changes to get it working again? It stopped working for me completely after Rubat made debug.getregistry return an empty table. I'm not sure how it's still working for you since it seems to return an empty table no matter what, meaning even when the "Circles" table is saved to the registry it will still return an empty table. Are you sure your game is fully updated?

Aws0mee commented 9 months ago

Additionally, when running the current code and printing debug.getregistry().Circles, I get nil. However, with my new code printing _G.Circles will return a valid table. I'm using the default branch, so maybe debug.getregistry is less bricked on one of the other branches of the game?

SneakySquid commented 9 months ago

Works completely fine on the latest update on the main branch.

Code:

print(VERSIONSTR, BRANCH)
print(include("circles.lua"))
print(include("circles.lua"))

Output:

2024.01.04  unknown
table: 0xbfca0cb2
table: 0xbfca0cb2

The important changes to _R are done in includes/init.lua so you might want to make sure the server you're testing on has an up to date/unmodified includes/init.lua. Keep in mind addons can overwrite this file too. You can use the command whereis lua/includes/init.lua to check if an addon is modifying it.

Aws0mee commented 9 months ago

Works completely fine on the latest update on the main branch.

Code:

print(VERSIONSTR, BRANCH)
print(include("circles.lua"))
print(include("circles.lua"))

Output:

2024.01.04    unknown
table: 0xbfca0cb2
table: 0xbfca0cb2

The important changes to _R are done in includes/init.lua so you might want to make sure the server you're testing on has an up to date/unmodified includes/init.lua. Keep in mind addons can overwrite this file too.

Alright, that's very odd I'll test again soon. Also, debug.getregistry is currently deprecated still, and Rubat doesn't seem to be very transparent with his changes. Maybe it's best to make this change anyway in case he changes how the registry works again and or removes the function entirely. I don't see any downsides, and I think it could save some future trouble, what do you think?

SneakySquid commented 9 months ago

Alright, that's very odd I'll test again soon. Also, debug.getregistry is currently deprecated still, and Rubat doesn't seem to be very transparent with his changes. Maybe it's best to make this change anyway in case he changes how the registry works again and or removes the function entirely. I don't see any downsides, and I think it could save some future trouble, what do you think?

I doubt that debug.getregistry will ever be completely removed. If it is I'll revisit the idea of making a global.