Closed sircfenner closed 2 months ago
There is a strategy
parameter to the existing rule which lets you pick between both translations
When set to string
, it will use the %s
formatter and add the call to convert the value. You can get it to use %*
when it is set to tostring
.
It is mentioned there: https://darklua.com/docs/rules/remove_interpolated_string/#parameters
Currently, the following expression:
is translated as:
This can be simplified to:
This also more closely matches how Luau compiles it and means we don't need to track if
tostring
has been redefined somewhere.In fact, the most accurate translation is:
This would also mean we don't need to track if
string
was redefined.This may have a minor performance drawback as currently Luau doesn't optimize this method-call style for string functions.