Post your questions and help other users.
Moderator: Martin
-
Bluscre
- Posts: 145
- Joined: 31 Aug 2017 13:58
- Location: Germany
-
Contact:
Post
by Bluscre » 13 Sep 2017 03:01
I might be stupid or too tired right now, but what was the way to iterate over a map again since for(key, value in map) doesn't work?
Code: Select all
ch.gridvision.ppam.androidautomagic.simplelang.a.d: Expression must return a collection but returned {title=com.google.android.apps.youtube.gaming:id/title, views=com.google.android.apps.youtube.gaming:id/num_views, description=com.google.android.apps.youtube.gaming:id/description, date=com.google.android.apps.youtube.gaming:id/upload_date, author=com.google.android.apps.youtube.gaming:id/channel_title, subscribers=com.google.android.apps.youtube.gaming:id/channel_subscribers} (Expression: for (k in el) {
k = el[k]
}
-
Desmanto
- Posts: 2709
- Joined: 21 Jul 2017 17:50
Post
by Desmanto » 13 Sep 2017 07:36
What do you wanna do? You can use getMapKeys() and getMapValues() to get the keys and values to list.
Code: Select all
el = newMapFromValues(
"title","com.google.android.apps.youtube.gaming:id/title",
"view","com.google.android.apps.youtube.gaming:id/num_views", "description","com.google.android.apps.youtube.gaming:id/description", "date","com.google.android.apps.youtube.gaming:id/upload_date", "author","com.google.android.apps.youtube.gaming:id/channel_title", "subscribers","com.google.android.apps.youtube.gaming:id/channel_subscribers");
x = getMapKeys(el); // this is all the keys
y = getMapValues(el); // this is all the values
for(i in getMapKeys(el)) //loop thru the Keys
//do whatever to the key
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
Bluscre
- Posts: 145
- Joined: 31 Aug 2017 13:58
- Location: Germany
-
Contact:
Post
by Bluscre » 13 Sep 2017 20:06
So like
Code: Select all
for (k in getMapKeys(el)) {
eval("global_"+k+" = "+el[k]);
}
?