Get Names of Expansion?
-
Hey!
Got a silly question! Heres my code:
const var expansionList = Engine.getExpansionList(); const var vptExpansion = Content.getComponent("vptExpansions"); vptExpansion.set("items", expansionList.join("\n"));
I'm showing the list of expansions as a viewport list. How do I change the values in the array from "Objectx#####" to the name of the expansion?
Thanks!
-
I believe you use the trace() function to see the contents of an array.
trace(expansionList)
-
@Casmat @Dan-Korneff I'm not familiar with expansions, but wouldn't
expansion.getProperties()
have the name somewhere inside? -
@ustk it's been a while since I've worked with expansions so you're probably closer to the answer than me. I just saw Array and Object and thought of the trace function.
-
You should use an expansion handler instead of the old Engine expansion stuff.
const expHandler = Engine.createExpansionHandler(); const expList = expansionHandler.getExpansionList(); const expNames = []; for (e in expList) expNames.push(e.getProperties().Name);
I have a lot of expansion stuff in my repo that you might find interesting - https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/includes/Expansions.js
-
@d-healey Thanks everyone!