Unsure if this a bug, as it’s happened recently, but basically I’m getting this error line on code like this:
It doesn’t error in game though
Unsure if this a bug, as it’s happened recently, but basically I’m getting this error line on code like this:
It doesn’t error in game though
It’s a warning from the linter. string.find is not guaranteed to return a number (if the string doesn’t contain a match, it will return nil), but it is used in a context where a number is required.
Setting the value to a variable and checking if it is truthy prior to performing operations on it will silence the warning, or you can explicitly downcast is by changing it to string.find(blockId, ":") :: number.
could do or something like this
(string.find(blockId, “:”) or 0) - 1)