Closed petzku closed 4 years ago
I should note, the behaviour for nil
at the end of the table is currently exactly the same as if those elements simply didn't exist.
Apparently the nil
-at-end-of-table part is simply a part of lua (love that language), and the way wave.transform
repeats the modifierFunctions when it doesn't have enough is actually documented behaviour.
The initial issue seems to be mostly fixed with the new call syntax as of c88e223, but some bugs remain with the old syntax. I'm working on a fixing PR currently.
Issue
I ran into this issue with a mistake in my code, effectively doing the following:
This produces transforms like
\t(0,1,1.00,\1a())
, which are clearly invalid. Also, style-resetting tags inside\t
:s don't behave nicely, apparently applying to the whole line at once, even before the transform's start time.So I tested a few things. The following:
errors with
If the order is switched, i.e.
it works, but uses
scalefilter
for\shad
as well:\t(0,1,1.00,\fscx100.00\fscy100.00\shad100.00)\t(0,26,0.97,\fscx103.83\fscy103.83\shad103.83)
.If the
nil
is given as the second function, it errors with the sameattempt to call a nil value
again.If we define another filter function, we can notice some more interesting behaviour:
In this case,
\fscy
is modified byshadfilter
:\t(0,1,1.00,\shad0.00\fscx100.00\fscy0.00)\t(0,26,0.97,\shad1.15\fscx103.83\fscy1.15)
.Proposal
Allow for
nil
to be used as a special value inside themodifierFunctions
table, effectively working as just a passthrough:function (x) return x end
. This is already the behaviour whennil
is given as the whole parameter. The same should probably be done if passed a table with less functions than we have transforming tags.