Multiple values to a key in a map? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Krd
Posts: 405
Joined: 10 Mar 2020, 02:46

Multiple values to a key in a map?

Post by Krd » 31 Mar 2023, 10:31

Hey!

I have this:

Code: Select all

function_name()
{
MapFunc(&who)
MsgBox who[A_UserName]
}

MapFunc(&who)
{
who := Map(
"User1", "First name",
"User2", "Another name",	
)
}
Sometimes I need to know another value of the key/user other than the name. My system would not let me pick users name I have to convert these user IDs to names.
The other value Would be something like this:

Code: Select all

function_name()
{
MapFunc(&who)
MsgBox who[A_UserName]
}

MapFunc(&who)
{
who := Map(
"User1", "First name", "Group 13",
"User2", "Another name", "Group 10",
)
}
How do I can make a call based on what I want from the first function(Value 1 or Value2)?

aliztori
Posts: 119
Joined: 19 Jul 2022, 12:44

Re: Multiple values to a key in a map?  Topic is solved

Post by aliztori » 31 Mar 2023, 11:11

I don't know if I understood correctly or not, but you can use multi-dimensional representations
https://www.autohotkey.com/docs/v2/Objects.htm#Usage_Arrays_of_Arrays

Post Reply

Return to “Ask for Help (v2)”