skript-yaml
skript-yaml copied to clipboard
Delete value from list
It seems that there is no straightforward way to find and remove value from yaml list. It would be great if there was an effect equivalent to:
function deleteFromYamlList(file: text, listnode: text, value: text):
set {_list::*} to yaml list {_listnode} from {_file}
loop {_list::*}:
if loop-value is {_value}:
set {_n} to loop-index parsed as number
delete yaml index {_n} of list {_listnode} from {_file}
Gotcha, I'll see what i can do ^.^
That will be possible in next version Here is an example code:
command /delindex:
trigger:
load yaml "plugins/test.yml" as "test"
set yaml list "Test.index" in "test" to "a", "b" and "c"
save yaml "test" #Setting Values
wait 5 seconds
loop yaml list "Test.index" in "test":
add 1 to {_amount}
if loop-value is "c": #Will delete last value
delete index {_amount} from list "Test.index" in "test"
save yaml "test"