You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deleting the last key by negative index does not work; deleting keys by value deletes all of them #183
-transform,-1 = delete does nothing -transform[airlockTopB] = delete deletes all of them -transform,1 = delete seems to work, but of course it's super fragile
Negative indexes are not implemented. Please read the Forum about (or at very least, the documentation).
Yes, the documentation says:
Delete - ! or -
Delete a node or value...For nodes, all options are available to select the node, including indexes. ...For values, again all options available.
(,<index-or-*>)? : Index to select particular match zero-based. 0 is the first node, -1 is the last node.
And obviously deleting ALL keys when trying to select by value is a bug.
And obviously deleting ALL keys when trying to select by value is a bug.
Yes and no.
There's nothing in the documentation saying that -transform[airlockTopB] = delete should delete just one with the value airlockTopB. This syntax just doesn't exists.
What I think it's happening is the code finds the first [ and automatically thinks it's parsing an ARRAY, doesn't understand a thing, and the code degenerates into "everything you find".
The bug is not -transform[airlockTopB] = delete deleting all instances, the bug is MM not raising an error on an evident syntax error and just ignoring the problem, degenerating the declaration to -transform,*[0] = delete implicitly.
Ah sure I did learn on re-reading the documentation that deleting a key always deletes all of them unlike nodes. So it seems like it's silently ignoring the value selector. Although again, the documentation says "all options available" but that appears to not actually be correct.
Activity
Lisias commentedon Mar 11, 2024
Negative indexes are not implemented. Please read the Forum about (or at very least, the documentation).
-transform[airlockTopB]is a silent syntax error.What you want to accomplish may be possible using
MM_PATCH_LOOP, something likeMM patches are not a programming language. They are a convoluted FSM declaring notation.
JonnyOThan commentedon Mar 11, 2024
Yes, the documentation says:
And obviously deleting ALL keys when trying to select by value is a bug.
Lisias commentedon Mar 16, 2024
Yes and no.
There's nothing in the documentation saying that
-transform[airlockTopB] = deleteshould delete just one with the valueairlockTopB. This syntax just doesn't exists.What I think it's happening is the code finds the first
[and automatically thinks it's parsing an ARRAY, doesn't understand a thing, and the code degenerates into "everything you find".Check https://github.com/sarbian/ModuleManager/wiki/Module-Manager-Handbook#arrays
The bug is not
-transform[airlockTopB] = deletedeleting all instances, the bug is MM not raising an error on an evident syntax error and just ignoring the problem, degenerating the declaration to-transform,*[0] = deleteimplicitly.Semantic matters.
JonnyOThan commentedon Mar 16, 2024
Ah sure I did learn on re-reading the documentation that deleting a key always deletes all of them unlike nodes. So it seems like it's silently ignoring the value selector. Although again, the documentation says "all options available" but that appears to not actually be correct.
Lisias commentedon Mar 16, 2024
The documentation sucks, no doubt.
Lisias commentedon Mar 17, 2024
Since I opened my big mouth here, I need to clarify: there're code to handle negative indexes - but for some nodes only, and
neverfor some values.