Skip to content
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

"Error in error handling" and Lua 5.4 deprecations #2727

Open
borbware opened this issue Dec 8, 2024 · 4 comments
Open

"Error in error handling" and Lua 5.4 deprecations #2727

borbware opened this issue Dec 8, 2024 · 4 comments

Comments

@borbware
Copy link
Contributor

borbware commented Dec 8, 2024

Has something changed in error handling? In 1.2.2997-dev pro i got this error message when running my game, but in 1.2.2883-dev pro everything works normally.

image

I use Lua, and the relevant code seems to be on line 98 in ldo.c....

@borbware
Copy link
Contributor Author

borbware commented Dec 8, 2024

hmm, i traced _VERSION and it differs, it used to be Lua 5.3 but now it's Lua 5.4

@borbware
Copy link
Contributor Author

borbware commented Dec 8, 2024

Okay, I figured something out. The culprit was this cursed function that I used to convert floats to integers:

function makeint(f)
	return string.format("%.0f",f)|0
end

(Luckily, Lua 5.3+ has a function math.tointeger that can be used instead.)

By running makeint(3.0) in the test cart, I actually got a meaningful error message instead of error in error handling:

[string "-- title:   game 
title..."]:15: attempt to perform 
bitwise operation on a string value
stack traceback:
	[C]: in metamethod 'bor'
	[string "-- title:   game 
title..."]:15: in function 'makeint'
	[string "-- title:   game 
title..."]:21: in function 'TIC'

So, my findings are:

  1. I guess when the stack is big enough, you don't get descriptive error messages anymore? Can this be fixed?
  2. There are some breaking changes in Lua 5.3->Lua 5.4.

This wasn't the only breaking change I found: After resolving this error, I stumbled upon another similar one. I'll continue my investigations, even though it is quite difficult because I can't see which line the error originated from....

@borbware borbware changed the title Error in error handling "Error in error handling" and Lua 5.4 deprecations Dec 8, 2024
@borbware
Copy link
Contributor Author

borbware commented Dec 8, 2024

Found another deprecation: math.atan2 is deprecated and should be replaced with math.atan that accepts two arguments now. Apparently this was already deprecated in Lua 5.3 but somehow it still worked before 5.4.

Nothing crashes for now, but I'll continue investigations later...

@Miguel-hrvs
Copy link
Contributor

I thought that the difference between 5.3 to 5.4 was smaller. I'll see if I can fix the error handler. We could also discuss if we want to revert to 5.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants