How to loop through yaml file?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

pepper82

Member
Jan 26, 2017
272
1
18
42
Hey all,
I have a yml file with content like this:

75b6363c-1fdb-49e3-9558-ed5f426fda5e: '1485603081'
25b6363c-1fdb-49e3-9558-ed5f426fda5e: '1485603081'

basically this is:

UUID: 'TIMESTAMP'

How can I loop through all of the entries and set their key to '0' ?
Or alternatively delete a specific entry / all entries?
 
You can try this:
code_language.skript:
set {_count} to file "the directory of the yml file here"'s line count + 1
loop {_count} times:
    set {_current} to file "the directory of the yml file here"'s line ({_count} - 1)
    set {_value} to subtext of {_current} from 1 to 36
    add {_value} to {_values::*}
then, you can do:
code_language.skript:
loop {_values::*}:
    set yml value loop-value of file "the directory of the yml file here" to 0
All using skUtilities.
 
Status
Not open for further replies.