-
-
Notifications
You must be signed in to change notification settings - Fork 509
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
Dividing by Zero in line
function causes Tic-80 to crash.
#1282
Comments
I tried to reproduce it on Windows without success, I suppose you are using Linux? |
Did some debugging. Found that when -- title: game title
-- author: game developer
-- desc: short description
-- script: lua
specialValue = 10
x = 10
instructions = "Press/hold UP to see the line"
function TIC()
cls()
print(instructions, math.sin(x / 50) * 50 + 50, 0)
print("Special Value: " .. specialValue, 10, 20)
x = x + 1
if btn(0) then
line(specialValue, 10, 20, 20, 13)
print("Up is pressed!", 20, 100)
instructions = "Press DOWN to set\n special value to 500 / 0"
end
if btn(1) then
-- Set special value to inf
specialValue = 500 / 0
instructions = "Press UP again to use inf in line()"
end
end |
Yes, I am |
i have had issues in other places with dividing by zero, so i had to add small float value to work around it. |
I did a little research, and agreed with @RobLoach |
The below code causes Tic-80 to completely crash, and in some cases it even slowed down the rest of my computer. I understand dividing by zero is impossible, but in other functions (namely
print
), it only throws an error.Note: I originally discovered the problem in Wren, but discovered it also applied when using Lua, I assume it also applies in other languages.
The text was updated successfully, but these errors were encountered: