#How to create a new key in YAML?

1 messages · Page 1 of 1 (latest)

normal roost
#

The title pretty much says it all

#

I would like to generate a new key with a new set of sub-paths and values, that sort of stuff

gaunt rapids
#

use dots

normal roost
#

what do you mean

#

I can already acces sub paths

#

that's not the problem

#

I just need a way to create a new key

gaunt rapids
#

okay, can you show me the example of config that you want?

normal roost
#
commandToRun:
   type: "String"
   value: "give"
   
selectorToUse:
   type: "String"
   value: "@s"

itemToGive:
   type: "String"
   value: "minecraft:stone"
#

that's kinda my file

#

it's a list of variables that I will then use ingame

#

so to add a variable, I would need to create a new key

#

say, add

newVar:
  type: "int"
  value: 14
gaunt rapids
#
config.set("newVar.type", "int");
config.set("newVar.value", 14);
``` that's it
normal roost
#

wait that adds?

#

it doesn't throw an error if the key doesn't already exist?

gaunt rapids
#

yes

#

it will create the key

normal roost
#

oooh

#

unless, of course, it already exists?

gaunt rapids
#

if it already exists

#

it will override

normal roost
#

ook

#

thank you!