darklua
DocumentationTry itGitHub

remove_interpolated_string


Added in 0.12.0

Parameters


NameTypeDescriptionDefault
strategy

"string" or "tostring"

Defines how darklua converts the interpolated strings into `string.format` calls. The "string" strategy will make the rule use the `%s` specifier and the "tostring" strategy will use the `%*` specifier.

string

This rule removes all interpolated strings and replaces them with string.format calls.

Examples


return `abc`
return ``
return `+{value} (in seconds)`
return `Total = {#elements}`
InputOutput
return `abc`
return 'abc'
return ``
return ''
return `+{value} (in seconds)`
return string.format('+%s (in seconds)', tostring(value))
return `Total = {#elements}`
return string.format('Total = %s', tostring(#elements))