#(L3Technosm) How to append to a list inside a map?
27 messages · Page 1 of 1 (latest)
(L3Technosm) How to append to a list inside a map?
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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
that's a weird format for pseudocode. You are talking about a denizen map, right?
Yes, a Denizen map.
- define node[locations]:->new_loc doesnt seem to do the trick.
map[locations=list[];name="Name"] <-- not valid syntax at all
can you paste your actual map object please
- define node <map[locations=list[];name=CoolSpot]>
- debug log <[node]>
- define node[locations]:->"Test"
- debug log <[node]>
output:
+> [DebugCommand] map@[locations=list[];name=CoolSpot]
[19:36:12 INFO]: +> [DebugCommand] map@[locations=list[];name=CoolSpot]
list[] will produce plaintext, not a list object
your data action is malformed, your quotes are in the wrong place, the map syntax is broken
this to say that maybe you should take a step back?
you seem to be making a lot of blind guesses with the syntax
Sorry, I wrote this snippet with haste...the actual script is more complex.
Overall, how do I append to a list inside a map?
- define node <map[locations=<list[]>;name=CoolSpot]>
- debug log <[node]>
- define node[locations]:->Test
- debug log <[node]>
I think this cleans up the extra quotes and wrong list object creation in the snippet.
Output:
19:38:17 INFO]: +> [DebugCommand] map@[locations=li@;name=CoolSpot]
[19:38:17 INFO]: +> [DebugCommand] map@[locations=li@;name=CoolSpot]
Ahhh, I think I got it:
- define node <map[locations=<list[]>;name=CoolSpot]>
- debug log <[node]>
- define node.locations:->:Test
Dot notation appears to work for the left side of a define.