You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an issue where permission checking will fail for flags defined after UseApplicationCommands. This is because permission flags above 31 require left-shifting beyond 1 << 31, which is not possible for Luau's bit32 library because it uses 32-bit numbers.
Edit: This can be fixed by using the mathematical equivalent, 2^n, where n is the second param passed to bit32.lshift when defining permission flags. Usage of bit32.band in the DiscordPermission can be fixed by splitting 64-bit numbers into two 32-bit parts (high & low) and then joining them back together.
Sample code (with appropriate typing) for bit32.band extended to 64-bit numbers:
This concept can be extended to other bit32 functions.
You can confirm this by trying something such as band(0xFFFFFFFF00000000, 0x0000FFFF00000000) vs. bit32.band(0xFFFFFFFF00000000, 0x0000FFFF00000000). The first result is what you will get if you compare with Lua 5.4 and run print(0xFFFFFFFF00000000 & 0x0000FFFF00000000)
The text was updated successfully, but these errors were encountered:
There is an issue where permission checking will fail for flags defined after UseApplicationCommands. This is because permission flags above 31 require left-shifting beyond 1 << 31, which is not possible for Luau's bit32 library because it uses 32-bit numbers.
Edit: This can be fixed by using the mathematical equivalent,
2^n
, where n is the second param passed tobit32.lshift
when defining permission flags. Usage ofbit32.band
in theDiscordPermission
can be fixed by splitting 64-bit numbers into two 32-bit parts (high & low) and then joining them back together.Sample code (with appropriate typing) for bit32.band extended to 64-bit numbers:
This concept can be extended to other bit32 functions.
You can confirm this by trying something such as
band(0xFFFFFFFF00000000, 0x0000FFFF00000000)
vs.bit32.band(0xFFFFFFFF00000000, 0x0000FFFF00000000)
. The first result is what you will get if you compare with Lua 5.4 and runprint(0xFFFFFFFF00000000 & 0x0000FFFF00000000)
The text was updated successfully, but these errors were encountered: