In all the Lua definitions of string.sub I could not find what it returns when the second index is positive yet smaller than the first.
E.g. string.sub(someString, 3, 2)
Will it always return the empty string ""?
In all the Lua definitions of string.sub I could not find what it returns when the second index is positive yet smaller than the first.
E.g. string.sub(someString, 3, 2)
Will it always return the empty string ""?
Yes.
Refer to: string.sub (s, i [, j]):
If (...) i is greater than j, the function returns the empty string.
i and j are respectively first and second indices from arguments.
Note that while 5.1's manual doesn't mention this behaviour (documentation for string.sub was extended in 5.2), the implementation didn't change in a meaningful way: 5.1, 5.2, 5.3 or 5.4; the behaviour is persistent across those versions.