As is, it has a couple of problem. First, it starts at the second character, but doesn't realize it (the first character position for selectSection is 0, not 1). So that is an easy fix, just change the 1 to a 0 in the for loop. It also means the if statement looking at i to set startc isn't needed, and startc can always be i+1. The second, bigger problem is that it doesn't work for single characters of a given color, and instead thinks the color continues to the end of the string. This is because it doesn't set endc until after a second character is found of that color, and string.sub with no second argument returns the rest of the string starting from the start point. This can be fixed by just declaring endc when startc is declared. Here is a corrected version.
getColorWildcard fix
getColorWildcard fix
So, here is the getColorWildcard function from the Other.lua file as is (with a few new lines put in for readability).
Re: getColorWildcard fix
It looks like the buggy version is still there: https://github.com/vadi2/mudlet-lua/blo ... r.lua#L515
Mind submitting a PR? Just hit the edit button on the top of the file (once logged in), drop your new function in and follow the instructions:
Mind submitting a PR? Just hit the edit button on the top of the file (once logged in), drop your new function in and follow the instructions:
Re: getColorWildcard fix
Okay, I think I did that successfully.
Re: getColorWildcard fix
Looks good! Appreciated.