Vanilla Forums has been nominated for a second time in the CMS Critic "Critic's Choice" awards, and we need your vote! Read more here, and then do the thing (please).
Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
Sir CarcassI have been shown the end of my worldAustin, TXRegistered Userregular
Is it possible to have a variable in a variable name?
I have some global instances of a class, NPC1, NPC2, NPC3, etc. I'm writing a function that will display detailed stats for an NPC. I was hoping to be able to pass an integer, like 4, and have the function show the stats of NPC4. I don't know if something like NPC<npcInt>.getName() is possible.
If not, how could I do this? Can I pass a global object through a function? I guess I could set them up as a linked list, which I may end up doing, but it seems a little overkill.