#(L3Technosm) How to append to a list inside a map?

27 messages · Page 1 of 1 (latest)

fleet wigeon
#

I have a map[locations=list[];name="Name"], how would I append a new location to that list inside the map?

neon elmBOT
#

(L3Technosm) How to append to a list inside a map?

neon elmBOT
#

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>

edgy glacier
#

that's a weird format for pseudocode. You are talking about a denizen map, right?

fleet wigeon
#

Yes, a Denizen map.

#

- define node[locations]:->new_loc doesnt seem to do the trick.

silk sinew
edgy glacier
#

can you paste your actual map object please

fleet wigeon
#
- 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]
edgy glacier
#

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

fleet wigeon
#

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.