Skip to content

Conversation

@C3pa
Copy link
Contributor

@C3pa C3pa commented Mar 18, 2023

All of these functions effectively call tostring(), when the passed parameter is a number. I think there is no need to raise warnings if users pass numbers instead of strings to these functions.

You can test this easily online: https://www.lua.org/cgi-bin/demo.

All of these functions effectively call `tostring()`, when the passed parameter is a number. I think there is no need to raise warnings if users pass numbers instead of strings to these functions.
@C3pa
Copy link
Contributor Author

C3pa commented Mar 18, 2023

@carsakiller can I get your opinion on this in addition to Sumneko's?

Copy link
Collaborator

@carsakiller carsakiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are quite a few places where numbers can be used, and they are converted to strings. Here are some of the ones I found.

@carsakiller
Copy link
Collaborator

I believe string.gmatch can also use numbers for the pattern parameter.

@C3pa
Copy link
Contributor Author

C3pa commented Mar 20, 2023

I believe string.gmatch can also use numbers for the pattern parameter.

I tested string.gmatch in Lua 5.4.4, and LuaJIT. Its s and pattern arguments can be numbers.

@sumneko sumneko merged commit b20f3f7 into LuaLS:master Mar 21, 2023
@C3pa
Copy link
Contributor Author

C3pa commented Mar 21, 2023

Thanks for the tests adjustment!

@C3pa C3pa deleted the update-string-annotations branch March 21, 2023 07:07
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

Successfully merging this pull request may close these issues.

3 participants