#(LeafyMitsuwa) Additional data action support

1 messages · Page 1 of 1 (latest)

wild root
#

I'd like to request additional data action support such as the ability to use indexes (as well as first/last) for the list actions
i.e. - define MyDef:<-:???

Current means of achieving this is - define MyDef <[MyDef].remove[last]>, which feels against the spirit of having a data action available for lists.

cyan timberBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

ripe rune
#

Does the data actions not work? Bc im pretty sure they should

#

!lang data action

humble starBOT
# ripe rune !lang data action

Several commands function as a way to modify data values,
including !command flag, !command yaml, and !command define.
These commands each allow for a set of generic data change operations.

These operations can be used with a syntax like "<key>:<action>:<value>"
For example "mykey:+:5" will add 5 to the value at 'mykey'.

The following actions are available:

Actions that take no input value:
Increment: '++': raises the value numerically up by 1. Example: - define x:++
Decrement: '--': lowers the value numerically down by 1. Example: - define x:--
Remove: '!': removes the value entirely. Example: - define x:!

Actions that take an input value:
Add: '+': adds the input value to the value at the key. Example: - define x:+:5
Subtract: '-': subtracts the input value from ...

Group

Useful Lists

ripe rune
#

At the bottom is examples of what it seems you are looking for

wild root
#

They do, to an extend; but perhaps I am not understanding its full capability.

ripe rune
#

Can you clarify your exact use case? Im not sure i follow what you are asking

wild root
#

I could, for example:

# Would output li@1|2|4
- define MyDef <list[1|2]>
- define MyDef:->:4

But what if I wanted to add something to the list at a specific index, or remove the last entry, which happens to be occur earlier in the list, of a list of i.e. li@1|2|3|4|2

# Would output li@1|3|4|2
- define MyDef <list[1|2|3|4|2]>
- define MyDef:<-:2
ripe rune
#

To remove at a specific index that would be define mydef[index]:<-

wild root
#

Thanks diamond_item