Jump to content

Potential UDF


Recommended Posts

So here is an example yml format. 

saveAllUsers: true
debug:
  path: This/Path/for/Files1
  showexceptions: true
  showlogs: false
Users:
  user1:
    name: John
    Age: 19
  user2:
    name: Jack
    Age: 22
    DOB: 7/1/92

Just a few simple functions is all I was really after. Read and setValue really.

Read could be compatible for something like readYML($file, "Users.user1.name") will return the text string "John".

Setvalue I think is where all the tricks come in. setValYML($file, "Users.user1.name.nick", "Johnboy") && setValYML($file, "Users.user3.name", "Bella") && setValYML($file, "Users.user3.favorites", "Pizza, Toast, Fish") Will endup setting the below code.

saveAllUsers: true
debug:
  path: This/Path/for/Files1
  showexceptions: true
  showlogs: false
Users:
  user1:
    name: John
      nick: JOhnboy
    Age: 19
  user2:
    name: Jack
    Age: 22
    DOB: 7/1/92
  user3:
    name: Bella
    favorites:
      - Pizza
      - Toast
      - Fish

Tabbing will have to be done in spaces only since traditional YML parsers do not accept tabs. Favorites will be returned as a string with commas separating the items because being able to call them individually with Users.user3.favorites-3 = Fish would be amaze.

Seems oddly specific I know, but it would make config files crazy simple since you just call the nodes and it does the rest. Building this into several of my functions would be crazy handy.

I sure hope that wasnt to confusing :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...