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
Currently, roblox-ts transpiles the modulo operator directly to a Lua modulo operator. This is an issue as in Lua, the modulo operator will always return a positive value, while TypeScript will return a negative value if the dividend is negative.
This seems unintentional, as roblox-ts takes measures to ensure parity with TypeScript in the case of things such as array indices starting from 0, where they start from 1 in Lua.
The text was updated successfully, but these errors were encountered:
After talking about this off-platform with the maintainer and some contributors, I want to let you know that fixing this issue is technically breaking. Therefore, depending on the project's direction, it may or may not be resolved in version 3.0.0.
Currently, roblox-ts transpiles the modulo operator directly to a Lua modulo operator. This is an issue as in Lua, the modulo operator will always return a positive value, while TypeScript will return a negative value if the dividend is negative.
Consider the following assertions (copied from the MDN web docs)
https://roblox-ts.com/playground/#code/IYZxFMCcBcAoEYDMACApMgrMgvL5iBKAbgChQIZYBaJNTHPKw08qOAFjoCYHtkAGYmTBtqndD1x9BpIA
This will pass when ran in TypeScript, but fail when ran through roblox-ts.
You can check this right now by running the following snippets:
TypeScript/JavaScript (run in the Inspect Element console window)
Lua (run in the Roblox command line)
This seems unintentional, as roblox-ts takes measures to ensure parity with TypeScript in the case of things such as array indices starting from 0, where they start from 1 in Lua.
The text was updated successfully, but these errors were encountered: