Arrays, Lists and Maps... Oh my...

So, I’ve been at an impasse lately. I’ve been wanting to be able to play with lists, arrays, maps, tables, etc in the scripting to make things more modular but I haven’t the foggiest on how to start with them here. I’ve been trying to find MVEL2 info on them and can see they WERE included in the language but there’s just not much out there on how to use them. Any hints would be great!

Creating them seems simple enough… I don’t really want to dig around the documentation to see what operations can and can’t be used on/with them:
http://mvel.documentnode.com/#inline-list-maps-and-arrays

Yeah, I found that list, problem is I cannot figure out how to actually call one in the script itself. The actual syntax. I haven’t messed with this outside of MUSHCoding and that uses an ENTIRELY different approach.

If you can point me to any documentation on it at all or if anybody knows a dirt simple way of doing that just to show an example, I’m pretty sure I can use that. Like… HelloWorld simple.

Would help to know where you’re trying to use them, but it seems simple enough to me. For an example of lists and maps, place the following in /templates/debug/num_stats.tpl, launch in dev mode, and check a proxy’s appearance from the Management screen, the proper values should show at the bottom (assuming the file is called by default in the character viewer and I didn’t modify mine to get that file called; my install is so messed-with that I have no idea anymore). I assume these work in events as well.

<% lst = [ctv.getStat("generic.str"),  ctv.getStat("generic.dex"), ctv.getStat("generic.spd"), ctv.getStat("generic.end"), ctv.getStat("generic.int"), ctv.getStat("generic.cha")]; lst; %>
<% map = ["Strength" : ctv.getStat("generic.str"),  "Dexterity" : ctv.getStat("generic.dex"), "Speed" : ctv.getStat("generic.spd"), "Endurance" : ctv.getStat("generic.end"), "Intelligence" : ctv.getStat("generic.int"), "Charisma" : ctv.getStat("generic.cha")]; map; %>

You don’t have to define that lst and map are lists and maps respectively, it’s done automagically.

Yup, that was me definitely trying to overthink that! Thankyou sir.

Also to quickly create new empty objects from scripts:

my_map = NewMap();
my_list = NewList();

Will be created standart java map and list objects.