Note that I’m manually converting it since I’m using --!strict
What the hell does that mean? You’re telling me you cannot convert something to a number when using --!strict?
Also, it’s even weirder when you use tostring(value), because NO WARNING.
Which means that for some reason tonumber(value) and tostring(value) don’t work for the same types. Should they support all types when using --!strict?
If it’s a bug then point it out in the comments. Otherwise just tell me what am I doing wrong.
It works, but why?
The warning is located in the tonumber, not in the assert. Also, as I mentioned how is the tostring not warning? I’m confused.
Is it both me doing it wrong and a bug?
This is still confusing me. I didn’t set it to number?, I set it to number. When I’m changing it to tostring and changing the type to a string then it does not show that same warning. Why is that?
index is a number and it should never have nil assigned to it. The function tonumber can return nil however, so with what you’ve written it’s possible that tonumber returns nil and gets assigned to index. That’s why you’re getting a warning about it.
tostring never returns nil so it’s not an issue.
If you’re 100% certain tonumber will return a number and not nil (which it should), then do what @D4_rrk suggested.